Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

syntax

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

like image 331
Umair Khalid Avatar asked Nov 20 '25 08:11

Umair Khalid


1 Answers

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.

like image 59
S k Avatar answered Nov 21 '25 23:11

S k



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!