How can I get python to return the full pathname of C:\myfolderisafolder\test?
E:\dev>cd VARESE~1
E:\dev\VARESE~1>python
>>> import os
>>> os.getcwd()
'E:\\dev\\VARESE~1'
>>> exit()
E:\dev\VARESE~1>cd ..
E:\dev>cd VAResearchDemo
E:\dev\VAResearchDemo>python
>>> import os
>>> os.getcwd()
'E:\\dev\\VAResearchDemo'
>>> exit()
As you can see, if I run python
in VARESE~1
directory, os.getcwd()
returns short path. If I run python
in same directory but with long path, it returns long path.
So, you should try to run python
in C:\myfolderisafolder\test
(check link's properties or how you run it).
But if you need to convert a short path to a long path, you have to call win32's GetLongPathName
function