Why can't I run a script in PyCharm, when I can debug it? I get CreateProcess error=123

I have a just reinstalled PyCharm but it is still causing me trouble: it will allow me to debug a python script, but it throws an error when I try to run it. The error when running is:

Error running test: Cannot run program "C:\Python27\python.exe" (in directory "C:\Users\Shellver\PycharmProjects\TestProject"): CreateProcess error=123, The filename, directory name, or volume label syntax is incorrect

I have tried creating new interpreters in other directories, I have turned off UAC, and have tried running PyCharm as administrator. Any other suggestions?

Thanks very much.

Trevor


PyCharm 2.7.1.
Windows 7 64bit
Python 2.7

success when debugging.png

error when running.png

interpreter settings.png
4
22 comments
Could you please attach a screenshot of your run configuration settings?
0
Thanks Dmitry. Here they are.

image1

image2
1
Please try going to Settings | Python Interpreters, deleting and recreating your Python interpreter. This should solve the problem.
0
Sorry Dmitry, I tried but it's exactly the same as it was :(

2013-03-13 22_26_45-Re_ Why can't I run a script in PyCharm, when I can debug it_ I get CreateProces.png

2013-03-13 22_28_59-Re_ Why can't I run a script in PyCharm, when I can debug it_ I get CreateProces.png
0
Here are my log files in case they help.
log.zip (27KB)
0
Hi Dmitry. Do you have any more suggestions please? I have tried multiple re-installs with no joy, and I'm out of ideas. Thanks!
0
Hello Dmitry - any response on this please? It's still a problem.
0
Avatar
Permanently deleted user
Hi Trevor! I see a lot of:
"Cannot run program "C:/Python27/python.exe" (in directory "C:\Python27"): CreateProcess error=2, The system cannot find the file specified "
in logs.

Definitely something wrong happened to your environment.

Can you manually launch python.exe?
Probably some environment variables are not set appropriately.
Please reinstall python on your machine.The directory with python installed and all its files should have appropriate rwx access mode for your user.

After that run PyCharm... go to  Settings | Project Interprreters | Python Interpreters.
Add your newly installed python interpreter, and set it as project interpreter in Settings | Project Interprreters

I hope it will work for you.
0
I'm sorry to say it's actually got worse: PyCharm won't even run now! It hangs during startup. The machine is generally ok: running ms office, visual studio, and allowing me to develop in python using notepad / idle etc.

Don't worry about it Dmitry. I'd say it's something to do with my setup rather than PyCharm itself. When I have time I'll have another go at it and try to get as close to a fresh install as possible. Thanks for you help anyway.
0
Avatar
Permanently deleted user

@Trevor Jobling,this is very old but for what its worth,  i fixed this by editing the workspace.xml file inside the repo i was workign on. It was pointing to an invalid python location:
file located here: "<local project location>\.idea\workspace.xml"

the script that wouldnt work was test_scripts.py. "SDK home" was pointing to an old location of python. i found this with a control+f of the error path

<configuration name="test_scripts" type="PythonConfigurationType" factoryName="Python" temporary="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="C:\ProgramData\Anaconda2\python.exe" />

5

Thanks for the suggestion Ryan. I'm not using Python these days but hopefully somebody will find that useful. Thanks for sharing!

0
Avatar
Permanently deleted user

@Ryan Elfman: Thanks! This solved this exact problem I have been having after I renamed some folders and launched PyCharm.

1

Well done Ryan - I'm delighted to see your helpful comment on a stale thread prove to be useful! :)

0
Avatar
Permanently deleted user

Hey, you never know when a PyCharm newbie may need help!

0
Avatar
Permanently deleted user

Glad i could help!

0

Hello, there must be a better way than manually change things on workspace.xml ... 

0

Try going to the edit configuration section on top right corner. 

select edit configuration 

change the python interpreter to the root python directory "python.exe" file (where you have installed the python at first)

Hope this helps!

WORKED FOR ME

0

@... Thanks, saved me as well :)

0

This isn't working for me

I have tried changing the SDK_HOME value and the interpreter.

0

Hello Chidansh El

 

Perhaps, I can assist. Could you please share a screenshot of the Run Configuration and describe the problem? 

0

THe solution was: make again a new run  config.

This is a problem when you save your setting from github and this config not works now in your local project, please fix this 

0

Even after updating it on the IDE config window it did not work.
Updating to the correct path/python-version on '.idea/workspace.xml' file worked! Thx Ryan Elfman!

0

Please sign in to leave a comment.