Python Forum

Full Version: pycharm doesn't offer option to run code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I'm looking at some code in the PyCharm IDE code editor, and I'd like to run it... so I click on run in the drop down menu

and it just comes up with 0. edit configurations.

I think its something to do with projects, and this not being a recognized bit of code of the project that pycharm thinks I'm still on. So I need to switch projects or something.

Any ideas?

Thx
Provided your settings are correct, you should be able to right-click the tab at the top of the code page your looking at and click 'run filename. Did you create a new python file under the current working directory? You need to provide more information other than "I'm looking at some code in the PyCharm IDE code editor"
while cursor is in code window, click run menu and select run
select your module and it should run (does for me)

once you have done that, the combo box on top left should have you module listed.
If you have moved anything around, or renamed any directories it's best to:
  • Save all
  • close project
  • with terminal window navigate to project directory and delete .idea
  • if on windows, best to delete the cache directory (if any) as well.
  • restart project
  • you will need to start project modules from run menu one more time as you are now dealing with a new .idea file
[Image: cVLrNnl.png]

>Did you create a new python file under the current working directory?

I did, but since then I've swapped my C and E harddisks around , and its causing file problems.
Anyway, I'm a bit further on now.
I've got pycharm to try compile the code in the IDE, but now its complaining it can't find C:\python27\python , cos its now on E:\ , so I need to tell pycharm to switch to E: Just a case of knowing where the filepaths are stored and changing them.
go to settings, interpreter and remove the old links and replace with new
the easiest way to do this is use the browse option (...)
to get to settings while a project is open, click on help and type settings
not working, get this
[Image: vVaaBn9.png]

Why is it complaining about a Software Dev Kit when it asks for an interpreter file address and I give it the interpreter file address?
( E:\python27\python.exe )
thx for fast responses, this is a good forum
You may have to click on the gear and add it to the list before you can select it with the pull down
I'm a bit confused, you keep saying you want to use Python 2.7 yet your screen shot shows you were using 3.6.2b2 (more on that in a bit).

A few questions:
1) Is drive 'E' a mirror of drive 'C'?
2) Did you do a fresh install of Pycharm?
3) Did you do a fresh install of Python?

Presuming you are indeed booting from the 'E' drive, and Pycharm is working in all other respects, open Pycharm and go to:

File --> Default Settings --> Project Interpreter
In right hand pane, the row that lists your Project Interpreter there is a little 'gear' icon. Click on the gear icon then click on 'Add Local'. Locate your 'python.exe'. If it does not come up automatically, click the 'house' icon on the left, this will allow you to scroll the entire drive(s).

If all else fails, I would uninstall Pycharm, uninstall Python. Reinstall Python then reinstall Pycharm.

If you are indeed using Python 3.6.2b2, you should really uninstall it anyway and install the stable version of 3.6.2, which is now available.
hi. Plz excuse the long hiatus.
The issue has been fixed, sorta, I worked around it. I just created a new project on the new C drive and copy pasted all the project files into the new cloned project. I would have liked to have fixed it by telling pycharm where to look for the old files, that would have given insight into some of the inner workings. But nevermind, its best just to be getting on with things.
Thx for the advice anyway.
As for which version I'm running. I'm not quite sure. Pycharm seems to be set to auto update or something because I have to reformat my code to match the latest version. e.g. recently had to mod code to suite the new 'no tuple unpacking from function parameter' rule. Going to 'about' on the help tab just tells you the version of pycharm, it doesn't tell u the version of the python interp.