Reputation: 31
I have a default folder called \normal however python detects the \n same with if i put extracted \" I keep getting permission denied writing and assuming it is because of the missing \
\"folder_normal = "F:\Extractor\normal"
folder_output = "F:\Extractor\Extracted\"
Edit
With the \ \ or the r it changes the folder to F:\\Extractor\\Extracted\\\\
what even with os.mkdir cannot find the folder
Upvotes: 2
Views: 639
Reputation: 5274
When I write Python in windows and have to deal with paths, I simply use forward slashes instead of back slashes. Sure, you can do proper escaping but it always turns into a hassle of errors it seems. So, change all your
\
to
/
So in this case, write this:
folder_output = "F:/Extractor/Extracted/"
And you should be good to go!
Upvotes: 1
Reputation: 1210
use raw format
folder = r"F:\Extractor\normal"
It's the best way to write paths because you don't need to worry about possible changes where you will miss another \a \b \n \t \v sign.
Alternatively you can use "/" instead of "\".
See: https://community.esri.com/blogs/dan_patterson/2016/08/14/filenames-and-file-paths-in-python to find other solutions
Upvotes: 2
Reputation: 2232
input an additional \
folder_normal = "F:\Extractor\\normal"
folder_output = "F:\Extractor\Extracted\"
Upvotes: 0