Python Forum
Accessing Files via Mobaxterm
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing Files via Mobaxterm
#1
[align=left]Hello, I have problems with accessing files through a code via mobaxterm:
The code takes a txt file as an input, and outputs an output txt file as an output
My code goes something like this:
import sys
import os
functions blah blah
file_output = open(sys.argv[2], "w")
file_input = open(sys.argv[1], "r")
os.chmod(sys.argv[2], 0o777)[/align]
Now, whenever I try to run the program with mobaxterm I get this message (movie.txt) is the input file:
https://imgur.com/a/FV759B7
What's wrong here? what do i need to do?
Reply
#2
The error seems pretty self-explanatory to me, it can't find the file. You need to either move the file to the same directory as where you're running the Python script, or provide the full path.

Also, in the future, please copy-paste the full error message rather than provide a screenshot.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Accessing files in various directories and folders ccuny 2 2,164 May-08-2019, 12:11 PM
Last Post: ccuny
  Accessing Files In A Folder asilverg 1 1,832 Feb-15-2019, 08:08 AM
Last Post: buran
  Accessing files via python gahdzilla 4 5,407 Jul-02-2017, 07:11 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020