Pycharm won't allow to run a file. Shows run unittest option only.
If you right-click inside the 'if name == "main"' block, it will show you the regular "Run script" option instead of "Run unit test". After that, you can save the created run configuration and use it to run the script.
One detail missing from @yole’s answer is that you need to delete any existing configurations associated with the file before you can right-click and get it to run/debug. So, the full procedure is:
- Delete any existing configurations for that file by going to ‘Run -> Edit Configurations’ in the menu.
- Right click inside the
if __name__ == '__main__':
block - Choose
Run
- Save the configuration
After that, you should be able to run or debug the file as expected.
I couldn't get @yole's answer to work but i did manage by going to run > edit configurations > new configuration (the plus sign) > select python, now input a name (mine was 'stop the bloody unittest') and select the correct script