run script from spyder console using relative path

Question:

I want to run .py file from ipython console in spyder. Script also takes csv file as input. But I got Exception: File src.py not found. How do I run the script from spyder console using relative path?

run src.py input.csv
Asked By: spb

||

Answers:

In this format, the path to your file is relative to the command working directory. Therefore, with your command, it looks for src.py in the directory where the console is running (that you can check by running pwd).

Therefore, you should either :

  • input absolute paths
  • open the command to the directory where your files (the script and the csv) are
Answered By: Benjamin Rio
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.