This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author John.Jefferies
Recipients John.Jefferies
Date 2013-07-21.18:54:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374432881.73.0.813388896506.issue18522@psf.upfronthosting.co.za>
In-reply-to
Content
I'm having trouble with a raw string of r'\\?\' as in the following session:
----------------
>>> a = r'\\?\'
  File "<stdin>", line 1
    a = r'\\?\'
              ^
SyntaxError: EOL while scanning string literal
----------------

which seems like a bug to me. I see the same behaviour in v3.3, v3.2, and v2.6. I have tried searching for such a bug but search engines don't work well with a string of non-alphanumerics.

Why is this string important? It's because the Win32 API functions throw an error with path names longer than 260 chars unless the path names are prefixed with this string, e.g:
    shutil.copy2(r'\\?\C:\some\quite\long\path\name', dstname)
    shutil.copy2(r'\\?\' + r'C:\some\quite\long\path\name', dstname)

where the first example throws an exception without the path name prefix; while the second example fails to compile.

FTR. I can create the desired string in various other ways:
----------------
>>> a = '\\\\?\\'
>>> a
'\\\\?\\'
>>> a = r'\\?\ '[0:4]
>>> a
'\\\\?\\'
>>>
----------------

Thanks

John
History
Date User Action Args
2013-07-21 18:54:41John.Jefferiessetrecipients: + John.Jefferies
2013-07-21 18:54:41John.Jefferiessetmessageid: <1374432881.73.0.813388896506.issue18522@psf.upfronthosting.co.za>
2013-07-21 18:54:41John.Jefferieslinkissue18522 messages
2013-07-21 18:54:41John.Jefferiescreate