conan icon indicating copy to clipboard operation
conan copied to clipboard

[bug] conan-script.py fails because of unicode character in python shebang

Open kauwua opened this issue 3 years ago • 4 comments

In C:\Users\UserWithé\AppData\Local\Programs\Python\Python310\Scripts, conan-script.py seems to be missing a # -*- encoding: utf-8 -*- at the top of the file. The shebang that gives the path to the python interpreter looks like this #!C:\Users\UserWith�\AppData\Local\Programs\Python\Python310\python.exe.

Without it, I got a "SyntaxError: Non-UTF-8 code starting with '\x91'" error when running conan, because my username has an accent in it.

Environment Details (include every applicable attribute)

  • Operating System+version: Windows Version 10.0.19044 Build 19044
  • Compiler+version: MSVC 19.29.30145.0 Visual Studio 16 2019
  • Conan version:1.50.0
  • Python version: Python 3.10.5

Steps to reproduce (Include if Applicable)

  1. conan

Logs (Executed commands with output) (Include/Attach if Applicable)

"failed to create process."

or SyntaxError: Non-UTF-8 code starting with '\x91'

kauwua avatar Jul 24 '22 12:07 kauwua

Hi @Riuzakiii

Can you please detail your OS, OS version, process to install Conan, Python version, process to install Python?

What you are describing, the conan-script.py is not a file that we generate, this seems to be part of the Python pip installer, I am not sure it is something that we can fix, but it could be a pip bug.

memsharded avatar Jul 25 '22 09:07 memsharded

The versions I'm using are in the "Environment details" of the description of the issue.

Process to install Python

  1. Download latest installer from https://www.python.org/downloads/windows/
  2. Add Python to the user path

Process to install Conan

  • python -m pip install conan

I realized my pip version was not the latest, so I upgraded pip with pip install --upgrade pip (upgraded to pip-22.2), did a fresh conan install, I still have the same issue image

I can open a ticket on the pip repository (or https://github.com/pypa/setuptools maybe) if you don't think this can be solved here.

kauwua avatar Jul 25 '22 21:07 kauwua

It seems this has already been reported, first in pip repo, then in setuptools in https://github.com/pypa/setuptools/issues/1246. Seems the default encoding could also be related.

memsharded avatar Jul 26 '22 00:07 memsharded

Thanks for finding the related issues, I might create a new issue in pypa/setuptools to see if this can be fixed (the two issues date back to 2018)

kauwua avatar Jul 26 '22 09:07 kauwua

Closing this as not an issue, it was apparently not a Conan issue.

memsharded avatar Mar 15 '24 23:03 memsharded