Python Forum

Full Version: Accessing Files via Mobaxterm
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[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?
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.