The PY file cannot be opened due to the Chinese characters in the path, and it results in an error

As shown in the screenshot, this is the error window that pops up, and it happens when trying to open a .py file in such a path. After testing, I found that in versions after 2024.2.0.1, both the Community Edition and Professional Edition have this issue where .py files cannot be opened if the path contains Chinese characters. This problem did not exist in earlier versions.

0
13 comments

Hi Zyuhao769, I am not able to reproduce it in the recent 2024.3 version:

As a general troubleshooting step, would you please try updating to the recent 2024.3 version of PyCharm and check if the issue persists on it?

I am wondering if you have any optimizations of VM options (Help | Edit Custom VM Options)? Would it help to revert these changes and retry?
 

0

In a Chinese path, when opening a .py file in Windows Explorer, an error pops up. Even after deleting all residual PyCharm files and uninstalling PyCharm, then reinstalling it, the issue persists. Additionally, the installation path of PyCharm does not contain any Chinese characters.

0

It is possible that the issue is related to the system version. Below is the version of my system. I tried installing the latest version of PyCharm on another computer with the exact same system version as mine, but without PyCharm installed, and I was able to reproduce the error. However, I meet the minimum system requirements listed on the official website.

0

Zyuhao769, for a better understanding of the issue, can you please provide a screen-cast / screenshots with all steps required to reproduce this behavior? Please also share idea.log from the log directory as per this article?

0

How to upload a log, the text inside the log is too long.

0

Please upload the logs to https://uploads.services.jetbrains.com and let me know the upload ID.
 

0

Upload id: 2024_11_20_wU3w6CJRXMVViejq3if76q (file: pycharm-logs-20241120-1732263420492575454720044.zip)

0

Zyuhao769, thank you for the log. I do not see any related errors in it, unfortunately.

Would you kindly share a screen-cast / screenshots with all steps required to reproduce this behavior?

0

I have uploaded a video showing my situation. Here is the upload ID.Upload id: 2024_11_20_XEK4jkGTVsvtzZbFYFb6gx (file: 20241120_193346.mp4)

0

This is a fresh installation, without any settings configured.

0

Zyuhao769, thank you for the screen-cast! 

Does the path to python files (parent directories) have spaces? Would it help to change the path name (remove white spaces) from it?

Can you open project directory from the IDE (not from Windows Explorer)? If it fails, would you please share actual logs from Help | Collect Logs and Diagnostic Data after reproducing the error?

0

There are no errors when opening this .py file in PyCharm. After checking, there are no Chinese characters in the path. This error can only be reproduced when the .py file is opened via the Windows File Explorer, and the path contains Chinese characters.

0

Zyuhao769, I am wondering if there are multiple versions of PyCharm installed in the system?

Can you please provide the output of the following snippet in Powershell to list .py associations from Windows Explorer?

ForEach ($i in $(Get-Item -Path Registry::HKEY_CLASSES_ROOT\.py\OpenWithProgids |
    Select-Object -ExpandProperty Property)) {
        (Get-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Applications\$i\shell\open\command")."(default)"
}
0

Please sign in to leave a comment.