Errorcode when running scripts in PyCharm

Cameron Simpson cs at cskk.id.au
Fri May 3 19:56:43 EDT 2019


On 02May2019 04:35, Hampus Sjödin <felixen989 at hotmail.co.uk> wrote:
>Den torsdag 2 maj 2019 kl. 13:31:29 UTC+2 skrev DL Neil:
>> On 2/05/19 11:05 PM, Hampus Sjödin wrote:
>> > Hey guys, so I've managed to ruin PyCharm for myself.. I just finished my first script in PyCharm and I tried renaming the file, so I closed PyCharm to reenter the file using the file manager.. And now it won't run when I try to.
>> >
>> > This is what I get:
>> >
>> > C:\Users\hampu\AppData\Local\Programs\Python\Python37-32\python.exe C:/Users/hampu/PycharmProjects/Laboration4/venv/Scripts
>> > C:\Users\hampu\AppData\Local\Programs\Python\Python37-32\python.exe: can't find '__main__' module in 'C:/Users/hampu/PycharmProjects/Laboration4/venv/Scripts'
>> >
>> > Process finished with exit code 1

This looks like you tried to "run" the venv Scripts directory.

But you actually want to run your own script. So from the below...

[...]
>I have Python installed in:
>C:\Users\hampu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.7
>
>I have Python.exe installed in: C:\Users\hampu\PycharmProjects\Laboration4\venv\Scripts
>
>I have Pycharm installed in: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\JetBrains
>
>And the current python file in: C:\Users\hampu\OneDrive\Skrivbord\lab4
>
>I'm gonna take a wild guess and guess that something needs to be moved.

it looks like you should be issuing the command:

  C:\Usershttp://www.cskk.ezoshosting.com/cs/ampu\AppData\Local\Programs\Python\Python37-32\python.exe C:\Usershttp://www.cskk.ezoshosting.com/cs/ampu\OneDrive\Skrivbord\lab4\your_script.py

Nothing should be moved: in particualr you do not want to put "your" 
files anywhere in the application install areas. Keep them where you 
have them, in your "lab4" folder.

You just want to tell Python what script to run.

Cheers,
Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list