I'm using VS Code on Windows 10 and have a fresh installation of the latest Python version (downloaded from python.org). I completely removed any older Python installations before reinstalling.
When I try to run a Python script using the terminal like this:
./test.py
I get this error:
[0711/233305.303:ERROR:icu_util.cc(223)] Invalid file descriptor to ICU data received.
However, if I run it using:
python ./test.py
It works perfectly.
I’ve made sure:
The script has the correct shebang line at the top: #!/usr/bin/env python
Python is properly added to my PATH
I'm using the integrated terminal in VS Code
Why does this happen and how can I fix or avoid this ICU-related error when using ./test.py
?
Environment:
Windows 10
VS Code
Python 3.13.5
./test.py
This is Linux syntax; Windows does not use /, but \
#!/usr/bin/env python
Again, Linux. As far as I know, it is ignored in Windows. Anyway, I would remove it.
All my (main) programs are called a.py (in different directories), in Windows, I start them just typing a (+Enter).
Because of the extension .py (file associations), Windows knows it should be opened by Python. Python makes the necessary steps during the installation, I suppose something went wrong.
Googled, not tested:
assoc .py=Python.File
ftype Python.File="C:\Path\To\python.exe" "%1" %*
Otherwise, uninstall and reinstall Python.