Problem with os.chdir()

venutaurus539 at gmail.com venutaurus539 at gmail.com
Wed Mar 11 13:50:39 CET 2009


On Mar 11, 5:19 pm, Tim Golden <m... at timgolden.me.uk> wrote:
> > Here is my code snippet which you will be interested in:
>
> Indeed.
>
> > file = ur'\\?\C:\\TestDataSet\DeepPaths
> > \DeepPathLevel01\DeepPathLevel02\DeepPathLevel03\DeepPathLevel04\DeepPathLe vel05\DeepPathLevel06\DeepPathLevel07\DeepPathLevel08\DeepPathLevel09\DeepP athLevel10\DeepPathLevel11\DeepPathLevel12\DeepPathLevel13\DeepPathLevel14\ DeepPathLevel15\DeepPathLevel16\DeepPathLevel172.txt'
>
> And what happens if you remove that second double-backslash,
> the one between C: and TestDataSet?
>
> TJG
----------------------------------------------------------------------------------------
Even if I give the file path as below

file = ur'\\?\C:\TestDataSet\DeepPaths
\DeepPathLevel01\DeepPathLevel02\DeepPathLevel03\DeepPathLevel04\DeepPathLevel05\DeepPathLevel06\DeepPathLevel07\DeepPathLevel08\DeepPathLevel09\DeepPathLevel10\DeepPathLevel11\DeepPathLevel12\DeepPathLevel13\DeepPathLevel14\DeepPathLevel15\DeepPathLevel16\DeepPathLevel172.txt'

I am still getting the exception:

Traceback (most recent call last):
  File "C:\JPDump\test.py", line 29, in <module>
    renameStubs(file)
  File "C:\JPDump\test.py", line 12, in renameStubs
    os.chdir (path)
WindowsError: [Error 206] The filename or extension is too long: u'\\\
\?\\C:\\TestDataSet\\DeepPaths\\DeepPathLevel01\\DeepPathLevel02\
\DeepPathLevel03\\DeepPathLevel04\\DeepPathLevel05\\DeepPathLevel06\
\DeepPathLevel07\\DeepPathLevel08\\DeepPathLevel09\\DeepPathLevel10\
\DeepPathLevel11\\DeepPathLevel12\\DeepPathLevel13\\DeepPathLevel14\
\DeepPathLevel15\\DeepPathLevel16\\'

Please help..
Thank you,
Venu M





More information about the Python-list mailing list