Home > Blockchain >  FileNotFoundError: [WinError 3] The system cannot find the path specified '<script drive>
FileNotFoundError: [WinError 3] The system cannot find the path specified '<script drive>

Time:12-17

I get this error everytime I try running this code:

script_path = os.path.realpath(__file__)
new_abs_path = os.path.join(script_path, 'Users')
if not os.path.exists(new_abs_path):
    os.makedirs(new_abs_path)

CodePudding user response:

Try this:

import os

path = os.path.join(os.path.dirname(__file__), 'Users')
if not os.path.exists(path):
    os.makedirs(path)

You forget to take the directory of your python script. You can t create a folder inside a file...

  • Related