PyDev.Debugger icon indicating copy to clipboard operation
PyDev.Debugger copied to clipboard

[Windows] Debugger not able to set break points if the filename is longer than MAX_PATH or if the path starts with "\\?\"

Open EricTheMagician opened this issue 6 years ago • 0 comments

On windows, there is a default file length limit of MAX_PATH (it's a C Macro defined to be 260).

However, it is possible to bypass this by prepending to the path: "\?" as explained here: https://stackoverflow.com/a/1880480/701403

Thus, our python path variables contain "\?" in the path and we are able to load modules with these really long paths. However, we are unable to set breakpoints (using PyCharm) as the path prepended with the "\?" is not recognized by pydevd as being the same file as the module without the "\?".

To reproduce, generate a really long filename and then try add a breakpoint to the new file.

You can generate a really long filename with this:

filename = 'a'*250 + '.py'
f = open("\\\\?\\" + os.path.join(os.getcwd(), filename), 'w') 
f.write("""print("hello world")""")
f.close()    

EricTheMagician avatar Mar 19 '18 18:03 EricTheMagician