I've been writing a program which writes to text files in the directory it's placed in. So, to find the path to the directory it is placed in, I used this statement:
currentpath = os.path.dirname(__file__)
But whenever I call the program outside of Idle it gives the error:
OSError: [WinError 123] The filename, directory name or volume label syntax is incorrect
I have no idea why this is happening, and even less why it happens outside of Idle and not inside.
So please can someone help because I have little hope of solving this on my own.
Oh, and PS. The name of the file is "File sprayer.py" and the directory name is "File sprayer test". I'm not sure if that helps.