Python Forum
pycharm doesn't offer option to run code
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pycharm doesn't offer option to run code
#1
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
Reply
#2
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"
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
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
Reply
#4
[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.
Reply
#5
https://www.jetbrains.com/help/pycharm/c...oject.html
Reply
#6
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
Reply
#7
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
Reply
#8
You may have to click on the gear and add it to the list before you can select it with the pull down
Reply
#9
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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#10
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Code works but doesn't give the right results colin_dent 2 717 Jun-22-2023, 06:04 PM
Last Post: jefsummers
  Why doesn't this code work? What is wrong with path? Melcu54 7 1,795 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  color code doesn't work harryvl 1 893 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  Run code like cell pycharm arsouzaesilva 3 1,854 Sep-20-2021, 12:05 PM
Last Post: Larz60+
  My code doesn't work, can someone help me? aldasrasickas 5 2,809 Dec-21-2020, 02:26 PM
Last Post: aldasrasickas
  Line of code to show dictionary doesn't work MaartenRo 2 2,440 Jul-28-2020, 03:58 PM
Last Post: deanhystad
  Python Code doesn't work! the_entrepreneur 5 3,777 Apr-20-2019, 08:05 AM
Last Post: SheeppOSU
  Code doesn't loop after first RFID scan BadgerHack 5 4,292 May-01-2018, 11:07 AM
Last Post: BadgerHack
  Why doesn't this code work? hsezgin 4 3,422 Jan-12-2018, 01:44 PM
Last Post: hsezgin
  Multiprocessing doesn't work in this code mraabs 4 4,356 Dec-24-2017, 07:48 PM
Last Post: mraabs

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020