-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
poetry develop failing on non-ASCII characters #221
Comments
somehow the é is being encoded as iso latin-1 which is causing a unicode decode error.
|
I remember having this problem, but I couldn't reproduce it now. On what version are you? |
[email protected], on Windows 10, ran |
I only have this problem when the author name is retrieved from the Git config. If I set it manually by editing the |
I've done Since the This conflicts with the The simplest solution here is to specify For demonstration, running While looking into this issue, I also found that the same thing happens to the readme parsing: Poetry's README.md is UTF-8 on my machine but gets decoded as CP-1252 in |
I think utf8 is a reasonable assumption. To be safe it could always retry after guessing the encoding with something like chardet but I don't think that would be necessary, or at the very least just try CP-1252/ISO-8859 and then fail. |
As this issue is caused by |
@xsduan Can you check, that the latest poetry 0.12.17 fixes the issue? |
poetry master = $ poetry --version
Poetry 0.12.17
# installation...
poetry master = $ cd d:\git\poetry
poetry master = $ poetry install
#...
poetry master = $ poetry run pip show poetry
Name: poetry
Version: 0.12.11
Summary: Python dependency management and packaging made easy.
Home-page: https://poetry.eustace.io/
Author: Sébastien Eustace
Author-email: [email protected]
License: UNKNOWN
Location: d:\git\poetry
Requires: cachecontrol, cachy, cleo, html5lib, jsonschema, pkginfo, pyparsing, pyrsistent, requests-toolbelt, requests, shellingham, tomlkit
Required-by: looks like it |
@xsduan it looks like ... your edit left your comment incomplete. |
I can reproduce this error in poetry version 1.0.0 (Ubuntu 18.04) >> poetry init --author "Alex Müller"
...
Package name [test]:
Version [0.1.0]:
Description []:
[UnicodeDecodeError]
'ascii' codec can't decode byte 0xc3 in position 6: ordinal not in range(128) It seams that "poetry init" can't handle the non ascii character in the author default in the dialogue. However it has no problem if the non ascii character is put after the prompt. The following works fine >> poetry init --author Alex
...
Package name [test]:
Version [0.1.0]:
Description []:
Author [Alex, n to skip]: Alex Müller
License []: |
Thanks @laxas , with your example I was able to reproduce it with python 2.7. With python3 it works. The problem seems to be well known, e.g. : https://stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte A simple fix would be changing this: poetry/poetry/console/commands/init.py Line 81 in affe32d
into
But I guess, this is such a general problem and should be fixed in another place. fin swimmer |
I have the same problem as @laxan. Can't init new project because of non-ascii character in my git user name. |
The same here! My lastname has an ó ➜ rgh git:(develop) poetry init -vvv
This command will guide you through creating your pyproject.toml config.
Package name [rgh]:
Version [0.1.0]:
Description []:
'ascii' codec can't encode character u'\xf3' in position 29: ordinal not in range(128)
'ascii' codec can't encode character u'\xf3' in position 29: ordinal not in range(128)
'ascii' codec can't encode character u'\xf3' in position 29: ordinal not in range(128)
... |
Passing the author to the cli with non-ascii characters also triggers the error: ❯ poetry init --author="an accent í is non-ascii"
This command will guide you through creating your pyproject.toml config.
Package name [non-ascii-test]:
Version [0.1.0]:
Description []:
[UnicodeDecodeError]
'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128) But if a non-ascii character is used when prompted to confirm the author, it does not fail: ❯ poetry init --author="ascii"
This command will guide you through creating your pyproject.toml config.
Package name [non-ascii-test]:
Version [0.1.0]:
Description []:
Author [ascii, n to skip]: non-ascii í
License []:
... |
I get the same on
This is on MacOS. |
Poetry
using this minimal
|
@jacebrowning Thank you! If you could point me to the place where the AUTHOR_REGEX is defined (I can't find it!) I would be happy to contribute a pull request to help fix this. Perhaps a good approach would be to validate only what is in between <> tags, and allow the name to be anything? (Because some languages will use apostrophes, colons, combining makrs and other characters that re is likely to miss?) |
@julienmalard It looks like And imported here: poetry/poetry/console/commands/init.py Lines 491 to 498 in d2fd581
|
@jacebrowning Thank you! I had not noticed that poetry.core was not part of this repository. |
I have just encountered this problem when I tried installing and running Poetry from my raw Docker container with Ubuntu Bionic. The quick fix for me was to do:
A more permanent solution for my Docker container I have found here:
|
@stanislaw what version of poetry do you have? What you describe is a workaround.
|
@vlcinsky sure I understand. I just needed to get something done really quickly.
The full output:
I have installed it like this:
|
Thanks @stanislaw for detailed report. My note was about robustness of I have met dependency of |
@jacebrowning Thanks for the pointer a few months back regarding Replacing
So my question would now be - should I submit a pull request with |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
As far as I know, the
re
library doesn't have any ability to support unicode character classes butregex
can handle them properly.I don't know if this has been brought up before or this is a windows-only thing, considering this happened while
poetry develop
ing poetry itself. as far as I checked, nobody has made an issue about this before.Windows 10, python 3.6.4, poetry 0.11.0a3.
edit: #66 is similar.
In the meantime, catching errors:
The text was updated successfully, but these errors were encountered: