0

I try to run a python function from command-line:

H:\myfolder\python.exe -c "from P:\myproject\myscript import myfct; myfct(1,2)"

An error occurs with this message:

P:\myproject\myscript ...
 ^
SyntaxError: invalid syntax

It works fine without the folder path:

H:\myfolder\python.exe -c "from myscript import myfct; myfct(1,2)"

The script should preferably run from other directories as well. Double backslash does not solve the problem as also stated here. As far as I can judge, it's not a problem of directory change. How do I have to write the command string which contains the full file path?

The directory P: is a mapped network directoy. Is this a problem?

I'm using Python 3.9.5 on Windows 10 Pro.

stonebe
  • 482
  • 1
  • 3
  • 14

0 Answers0