Umair Khalid
Umair Khalid

Reputation: 150

Python Error 123 The filename, directory name, or volume label syntax is incorrect

I am trying to make directory using os.mkdir in python
It works fine when path is D:\screenshots\data

os.mkdir("D:\screenshots\data")

but it gives error when path is D:\screenshots\subs:air.com.freshplanet.games.MoviePop:moviepop.vip.1month

os.mkdir("D:\screenshots\subs:air.com.freshplanet.games.MoviePop:moviepop.vip.1month")
[Error 123] The filename, directory name, or volume label syntax is incorrect: 'D:\\screenshots\\subs:air.com.freshplanet.games.MoviePop:moviepop.vip.1month'

I don't know why it is giving this error

Upvotes: 3

Views: 13489

Answers (1)

S k
S k

Reputation: 23

I experienced a similar error while working in jupyter notebook.similar to OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: And i figured it out to be a double slash instead of single. I don't know why i had to give double back slash(\) instead of single. How ever it solved my problem Even before a day i used the same single back slash() to change directory. Please comment if someone knows about it.

Upvotes: 2

Related Questions