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

10,236

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.

Share:
10,236
Umair Khalid
Author by

Umair Khalid

Full Stack ReactJs | NodeJs | Ruby on Rails developer with 4 years of experience in web development. Deployed websites on Amazon EC2 and Heroku and linked with other Amazon web services like RDMS, Dynamodb, and buckets for storing data. To optimize search and enhance user’s experience on extensive data, I have used elastic search. I have also written unit tests in ReactJs NodeJs using mocha and jest. In ReactJs, I have worked with both major versions of ReactJs (classes and hooks) and integrated them with redux-thunk, redux sagas, and mobx to improve user experience.

Updated on June 28, 2022

Comments

  • Umair Khalid
    Umair Khalid almost 2 years

    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