microsoft/vscode-python

Debugging opens new all-lowercase file

whubbla opened this issue ยท 10 comments

Issue Type: Bug

When I open a .py file, and set a breakpoint of StopOnEntry=True in launch.json, and start debugging, as soon as a breakpoint or initial stop is hit (or there's a runtime error), another tab opens with an all-lowercase version of the filename (it previously was a mix of lower and upper-case).

So, I then have two tabs, MyScript.py and myscript.py. The debugger is active in myscript.py, even though I started it from MyScript.py.

I hover over the original one (MyScript.py), and it says something like (capitalization pattern reproduced here): "Q:\Myname\GitHub\FolderPath\SubPath123\Othername\MyScript.py"

If I hover over the all-lowercase file, it shows this:
"Q:\Myname\GitHub\folderpath\subpath123\Othername\myscript.py"

So, it changes the case in folderpath and subpath123 and myscript, but not in Othername.

It still saves to the proper filename, but it gets confusing in the code editor.

I'm using "Python: Current File (Integrated Terminal)" and it looks like this:

"version": "0.2.0",
"configurations": [
    {
        "name": "Python: Current File (Integrated Terminal)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "stopOnEntry": true,
        "console": "integratedTerminal"
    },

Extension version: 2019.3.6215
VS Code version: Code 1.32.3 (a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4, 2019-03-14T23:43:35.476Z)
OS version: Windows_NT x64 10.0.17763

System Info
Item Value
CPUs Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz (8 x 2500)
GPU Status 2d_canvas: disabled_software
checker_imaging: disabled_off
flash_3d: disabled_software
flash_stage3d: disabled_software
flash_stage3d_baseline: disabled_software
gpu_compositing: disabled_software
multiple_raster_threads: disabled_off
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
surface_synchronization: disabled_off
video_decode: disabled_software
webgl: disabled_off
webgl2: disabled_off
Memory (System) 31.65GB (24.55GB free)
Process Argv
Screen Reader no
VM 0%

Can confirm this behavior. Set a breakpoint in the python file. When debugging, the file is reopened with a lower case name. This is no problem as long as the open tab is not static (i.e. edited the file) so the tab can be replaced with the "new" file with the name all in lower case.

VSCode: 1.32.3
Python extension: 2019.3.6215 (28 March 2019)
OS: Win7

Please could you do the following:

  • Open VS Code
  • Select the command Extensions: Open Extensions Folder
  • Locate the Python extension directory, typically of the form ms-python.python-2019.3.****
  • In that directory ensure you do not have any debug*.log files, if you do, please delete them
  • Go back into VS Code and modify your launch.json to add the setting "logToFile": true, see below:
"version": "0.2.0",
"configurations": [
    {
        "name": "Python: Current File (Integrated Terminal)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "stopOnEntry": true,
        "console": "integratedTerminal",
        "logToFile": true
    },
  • Start debugging
  • When done (when you get the duplicate window opened), then
    • Go back into the extension directory
    • Upload the file debug*.log into this GitHub issue

Here you go. I tried to replicate the issue with more generic folder names (it replicated in the sense that the debugger opened another tab and messed with the capitalization in the file path, but the .py file itself didn't have its capitalization affected). So, this is the log from the original issue.
debug15860.log

Any updates on this issue?

I am also very eager for this fix. We are using VS Code company-wide, and this issue makes debugging really inconvenient. Hope you manage to solve it soon. :)

Please could you test this at your end, we added a few fixes related to this in the latest release.
Note: Please update to the latest version of the python extension.

Seems like file name CaSE is now not an issue anymore. A quick check didn't open any unwanted all-lower-case files.

However, upon extension update, I had to re-install extension (it was actully removed from my installation - very strange behaviour).
Than, after reinstallation, this message is displayed in integrated terminal before debug session (before normally working debug session):

cd 'd:\Stromarija\GIT\VS_Code_STM32_IDE\example\STM32F051K4\ideScripts\updateBuildData.py'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Python3.7_64x\python.exe' 'c:\Users\domen\.vscode\extensions\ms-python.python-2019.4.11987\pythonFiles\ptvsd_launcher.py' '--default' '--client' '--host' 'localhost' '--port' '61510' 'd:\Stromarija\GIT\VS_Code_STM32_IDE\example\STM32F051K4\ideScripts\updateBuildData.py'
cd : Cannot find path 'd:\Stromarija\GIT\VS_Code_STM32_IDE\example\STM32F051K4\ideScripts\updateBuildData.py' because it 
does not exist.
At line:1 char:1
+ cd 'd:\Stromarija\GIT\VS_Code_STM32_IDE\example\STM32F051K4\ideScript ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (d:\Stromarija\G...ateBuildData.py:String) [Set-Location], ItemNotFoundExcept 
   ion
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

@DonJayamanne - I tested after updating to the latest release, and the problem is resolved for me. I did not encounter any of the issues mentioned by @schperplata .

I updated the extension and the issue got resolved for me. Thank you so much!

The problem is gone for me, as well. Thanks a lot!