0

I am reaching out due to an issue while trying to run a ".py" file on Windows 11.

After entering this on the command prompt:

py \C:\Users\ibrah\AppData\Local\Programs\Python\Python3.12\Waterfall%20Plot.py,

the following message is rendered

C:\Users\ibrah> py .\C:\Users\ibrah\AppData\Local\Programs\Python\Python3.12\Waterfall%20Plot.py
C:\Users\ibrah\AppData\Local\Programs\Python\Python312\python.exe: can't open file 'C:\\Users\\ibrah\\C:\\Users\\ibrah\\AppData\\Local\\Programs\\Python\\Python3.12\\Waterfall%20Plot.py': [Errno 22] Invalid argument

while no "python.exe" file exists in the "Python312" folder.

Does this mean the command is typed incorrectly, the access to the file(s) and / or folder(s) is restricted, or anything else?

In case there is any other alternative to execute the file, what would it be?

Also, what is the difference between the two folders Python312 and Python 3.12, since both have been installed with Python? Is the first one supposed to be installed with it since neither python.exe nor python-312 can be found in the tags while python-3.12 can be?

Greetings.

4
  • Is there really %20 in the file name? It's URL encoding for a space. Does using a space and wrapping the file name in quotes maybe work? Like: "C:\Users\ibrah\AppData\Local\Programs\Python\Python3.12\Waterfall Plot.py" Commented Jun 11, 2024 at 17:52
  • I actually wrapped the file path in quotes and it was run, however, an error message is rendered when I run the file with "py C:\Users\ibrah\Waterfall Chart.py" --> "SyntaxError: closing parenthesis '}' does not match opening parenthesis '[' on line 4" while '}' is actually a brace and '[' is a hook. Does anyone know more about this error message? Commented Jun 12, 2024 at 10:39
  • It's a new problem so it's best to ask a new question. Make sure to include the relevant code and the exact error message. Judging from the error message, I'd assume there's actually a wrong brace in the code. Commented Jun 12, 2024 at 10:43
  • Regarding the .\ perhaps see also Difference between ./ and ~/ Commented Jun 12, 2024 at 10:53

2 Answers 2

0

The [Errno 22] Invalid argument error you're receiving is because the path of your Python script is invalid. Remove the .\ at the beginning.

py C:\Users\ibrah\AppData\Local\Programs\Python\Python3.12\Waterfall%20Plot.py

As for the folder names, Python usually uses the naming without the period for the interpreter. Your interpreter should be in the Python312 folder.

As for the other one, it could have been added by an environment manager, though I'm not aware of what could be using that Python3.12 folder.

Sign up to request clarification or add additional context in comments.

Comments

0

There are two errors in your command line.

  1. A path starting with a drive letter is absolute, while .\ would indicate a relative path. Lose the initial .\.
  2. The %20 is URL encoding for a space. As space also separates arguments, thus you will also need to wrap the entire file name in quotes to pass it as one argument.

The following line will run your script:

py "C:\Users\ibrah\AppData\Local\Programs\Python\Python3.12\Waterfall Plot.py"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.