I'd like to run a Python file in VSC but the file requires external data from two different .txt files.
As an example, if I run it in the Python IDLE, I'd open the Python file, select Run...Customized, and enter the path to the .txt file, (e.g. data/xxxxx.txt data/yyyy.txt output.png) and then run it.
Could you please indicate if there is a way to run a file in that way in VSC, or refer me to where I can find any supportive documentation that would cover this special requirement?
This is the function where the exception occurs:
def main():
# Check usage
if len(sys.argv) not in [3, 4]:
sys.exit("Usage: python generate.py structure words [output]")
# Parse command-line arguments
structure = sys.argv[1]
words = sys.argv[2]
output = sys.argv[3] if len(sys.argv) == 4 else None
# Generate crossword
crossword = Crossword(structure, words)
creator = CrosswordCreator(crossword)
assignment = creator.solve()
# Print result
if assignment is None:
print("No solution.")
else:
creator.print(assignment)
if output:
creator.save(assignment, output)
And this is the exception in VSC:
Exception has occurred: SystemExit
Usage: python myfile.py structure words [output]
File "/Users/#######/myfile.py", line 277, in main
sys.exit("Usage: python myfile.py structure words [output]")
File "/Users//#######/myfile.py", line 299, in <module>
main()

launch.jsonset thecwdto the location you want