0

Default python folder: c:/python My script file name.py is in that folder. Tested my script in the shell and works. When i do python name.py is gives me syntax error in cmd Now when i changed command prompt start in location to the python folder it worked. Is there a way i dont have to do that but for it to still open if i do python name.py? Or what do you all recommend?

When i just type python it shows version etc. So i know the variables for that are correct... So i have no clue

  • We are going to need more information. What commands are you running, what is the exact error code, what is the line of the code that is causing the error – James Aug 20 '19 at 11:27
  • Don't do this, just write `python the\full\path\name.py`. – Veedrac Aug 20 '19 at 13:47

1 Answers1

0

You can update your PYTHONPATH environment variable to the directory containing your script C:/python. See the answer to this question.

However, this is not the typical, recommended way to find your Python scripts. It is best to use something like this:

import sys
sys.path.append('C:/python')
Kevin
  • 16,549
  • 8
  • 60
  • 74