Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get "ParserError: (:) [], ParentContainsErrorRecordException" when executing python script in Powershell

I try to execute a python script in Powershell, I get this error. The script itself is correct, I can execute the same command in CMD.

So what should I write in powershell?

"C:\Program Files\Python36\python.exe" .\setup.py install
At line:1 char:40
+ "C:\Program Files\Python36\python.exe" .\setup.py install
+                                        ~~~~~~~~~~
Unexpected token '.\setup.py' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
like image 288
Jim Avatar asked Mar 08 '23 01:03

Jim


1 Answers

You need to put an ampersand in front of your application name (here its python.exe)

& "C:\Program Files\Python36\python.exe" .\setup.py install

PowerShell needs the ampersand to interpret the string as a filename.

like image 71
rollstuhlfahrer Avatar answered Apr 08 '23 10:04

rollstuhlfahrer