'Pycharm Python "can't open file","[Error 2] No such file or directory"

Whenever i try to run main.py i get this error 'can't open file PATH\main.py': [Errno 22] Invalid argument' And after running second time file get deleted or disappears How can I fix it?



Solution 1:[1]

I believe [Errno 22] is typically due to invalid inputs.

I would check if the file path is correct (including format such as .py at the end) and maybe try using / or \ instead of a single \ for windows.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wong Wai Kwun