I am new to programming, this is actually my first work assignment with coding. my code below is throwing an error:
WindowsError: [Error 123] The filename,
This is kind of an old question but I wanted to mentioned here the pathlib library in Python3.
If you write:
from pathlib import Path
path: str = 'C:\\Users\\myUserName\\project\\subfolder'
osDir = Path(path)
or
path: str = "C:\\Users\\myUserName\\project\\subfolder"
osDir = Path(path)
osDir will be the same result.
Also if you write it as:
path: str = "subfolder"
osDir = Path(path)
absolutePath: str = str(Path.absolute(osDir))
you will get back the absolute directory as
'C:\\Users\\myUserName\\project\\subfolder'
You can check more for the pathlib library here.