0

I'm using Pycharm and I have an issue. I can't just click run and run files on their own, if they are in a project file. I can, but I need to keep changing and deleting the 'configurations' at the top right every time I switch files. It keeps creating new configurations every time I open a new file, which is why I changed the default value of 5 to 1. I did this so I don't have to keep deleting it, but I still have to change it every time I switch files and want to run that file. It's pretty annoying, is there anyway to just run the files like normal without having to change the configurations?

image 1

image 2

image 3

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Lani
  • 35
  • 8
  • Running a file NEED a configuration, which means HOW to run that file – azro Jan 24 '21 at 09:25
  • so what can I do to immediately run each file without changing it everytime? @azro – Lani Jan 24 '21 at 09:27
  • 1
    Right-click the mouse anywhere inside the file view and press `Run ...` or `ctrl+shift+F10` on windows or just press the green arrow at the top-right corner – Tomerikoo Jan 24 '21 at 09:28
  • 1
    Use a main like https://pastebin.com/ScAN6nNP then pycharm will add a green arro next to it, so you can run it easily – azro Jan 24 '21 at 09:30
  • Oh my god! Thank you so much @Tomerikoo , that is exactly what i was looking for. Is there any way to make it stop creating configurations? Or should I just leave it and let it keep creating and storing them at the top? – Lani Jan 24 '21 at 09:31
  • okay! thank you so much @azro , i'll definitely look into pastebin and find out what it does. – Lani Jan 24 '21 at 09:33
  • As azro said, configurations are necessary. It's just not so necessary to worry about them and deal with them, with any of the ways proposed above. – Tomerikoo Jan 24 '21 at 09:33
  • I’m voting to close this question because answer has been given in comment. – azro Jan 24 '21 at 09:34
  • ah I see okay! i'm only saying this because i changed the location of one of my files yesterday and i couldn't run any of my other files because I didn't know that the old file configuration was still on. – Lani Jan 24 '21 at 09:35
  • okay! thanks guys! – Lani Jan 24 '21 at 09:36
  • @azro I don't quite agree with this close vote. If the question was solved through comments, they should be turned to an answer and accepted to "close" the question. It shouldn't be ***closed*** closed – Tomerikoo Jan 24 '21 at 09:45

1 Answers1

3

Collecting comments to an answer:


Running a file need a configuration, which means how to run that file.

It's just not so necessary to worry about them and deal with them, using one of these ways:

  • Right-click the mouse anywhere inside the file view and press Run <filename>

  • ctrl+shift+F10 on windows

  • Use a main guard and Pycharm will add a small green arrow through which you can run the file directly:

    An image showing a single line of code: if __name__ == "__main__": with a green arrow added next to it automatically. The arrow is highlighted with a red circle

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61