/home/saumen/.local/lib/python2.7/site-packages/django/core/management/__init__.py:316: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if subcommand == 'runserver' and '--noreload' not in self.argv:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 61, in execute
super(Command, self).execute(*args, **options)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 86, in handle
'or address:port pair.' % options['addrport'])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
I am getting the error when I run python runserver --nothreading -noreload.what Can I do? I have installed mysqlclient and necessary python libraries.
First edit your answer and put code on line 86...
and error is happening because of UnicodeDecodeError:
This might work for you:(note: your_string is what you want to decode)
your_String.encode('ascii', 'ignore').decode('utf-8')
for more specific to your problem:
str(options['addrport']).encode('ascii', 'ignore').decode('utf-8')
Related
I am trying to install simpletransformers via pip, but it gives me the following error:
"ERROR: Exception:
Traceback (most recent call last):
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 180, in _main
status = self.run(options, args)
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 204, in wrapper
return func(self, options, args)
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 393, in run
installed = install_given_reqs(
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/req/__init__.py", line 77, in install_given_reqs
requirement.install(
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 782, in install
install_wheel(
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py", line 810, in install_wheel
_install_wheel(
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py", line 653, in _install_wheel
file.save()
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py", line 419, in save
with open(self.dest_path, "wb") as dest:
UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f4f9' in position 75: ordinal not in range(256)
"
I am working on jupyterhub and have tried creating a conda environment with Python version 3.7 as suggested in other cases, but the problem was not solved.
Any tips are welcome!
The problem comes from the encodage.
I think these topics could help you.
Streamlit install fails on GitLab CI with UnicodeEncodeError
'ascii' codec can't encode character : ordinal not in range (128)
In general google your error message you'll find o lot of related post and maybe your answer.
Trying to run
django-admin startproject mysite
and there occurs such problem
Traceback (most recent call last):
File "/Users/username/Desktop/test/venv/bin/django-admin", line 10, in <module>
sys.exit(execute_from_command_line())
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/core/management/commands/startproject.py", line 20, in handle
super().handle('project', project_name, target, **options)
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/core/management/templates.py", line 158, in handle
template = Engine().from_string(content)
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/template/engine.py", line 136, in from_string
return Template(template_code, engine=self)
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/template/base.py", line 155, in __init__
self.nodelist = self.compile_nodelist()
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/template/base.py", line 193, in compile_nodelist
return parser.parse()
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/template/base.py", line 447, in parse
filter_expression = self.compile_filter(token.contents)
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/template/base.py", line 563, in compile_filter
return FilterExpression(token, self)
File "/Users/username/Desktop/test/venv/lib/python3.6/site-packages/django/template/base.py", line 638, in __init__
var, constant = match['var'], match['constant']
TypeError: '_sre.SRE_Match' object is not subscriptable
I guess there is a problem with versions, but don't know exactly what is it.
On version 1.8.6 everything is ok, but when I try to use
from django.urls import path, include
I see that there is no django.urls in this version.
So I'd like to use the latest version and will be grateful, if you can help me!
Python version:
Python 3.6.0a4
It seems that you use an unofficial version of django.
Hello, try this first, dont remove anything leave pip do it for you:
pip install -U django
Now After that rerun startproject command line
use pipenv -h and other commands like --venv -install, UnicodeDecodeError: 'utf-8', pipenv commands are error.And i can't find answers in other places.
F:\proc_py\pipEnv>pipenv -h
Traceback (most recent call last):
File "e:\python3.6\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "e:\python3.6\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "E:\python3.6\Scripts\pipenv.exe\__main__.py", line 5, in <module>
File "e:\python3.6\lib\site-packages\pipenv\__init__.py", line 47, in <module>
from .cli import cli
File "e:\python3.6\lib\site-packages\pipenv\cli\__init__.py", line 3, in <modu
le>
from .command import cli
File "e:\python3.6\lib\site-packages\pipenv\cli\command.py", line 7, in <modul
e>
import crayons
File "e:\python3.6\lib\site-packages\pipenv\patched\crayons.py", line 49, in <
module>
is_powershell = "powershell" in shellingham.detect_shell()[0]
File "e:\python3.6\lib\site-packages\pipenv\vendor\shellingham\__init__.py", l
ine 22, in detect_shell
shell = get_shell(pid, max_depth=max_depth)
File "e:\python3.6\lib\site-packages\pipenv\vendor\shellingham\nt.py", line 10
0, in get_shell
processes = dict(_iter_process())
File "e:\python3.6\lib\site-packages\pipenv\vendor\shellingham\nt.py", line 78
, in _iter_process
info = {'executable': str(pe.szExeFile.decode('utf-8'))}
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 0: invalid
start byte
I do not know why, pipenv commands are error.And i can't find answers in other places.
I've met same problem and was lurking internet for a solution but having not much time and figured out some possible workaround for making it
I was tryin to install PIPEnvironment through Pycharm interpreter settings and problem occured:
Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "C:\Users\ogmamedo\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\decorators.py", line 17, in new_func
[pipenv.exceptions.VirtualenvCreationException]: return f(get_current_context(), *args, **kwargs)
[pipenv.exceptions.VirtualenvCreationException]: File "C:\Users\ogmamedo\AppData\Roaming\Python\Python37\site-packages\pipenv\cli\command.py", line 208, in cli
[pipenv.exceptions.VirtualenvCreationException]: clear=state.clear,
[pipenv.exceptions.VirtualenvCreationException]: File "C:\Users\ogmamedo\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "C:\Users\ogmamedo\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "C:\Users\ogmamedo\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
File "C:\Users\ogmamedo\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 939, in call_subprocess
line = line.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 280: invalid continuation byte
I went to a file
"C:\Users\ogmamedo\AppData\Roaming\Python\Python37\site-packages\virtualenv.py"
And changed code like this:
encoding = sys.getdefaultencoding()
fs_encoding = 'OEM' #sys.getfilesystemencoding()
This helped me to pass that stage (first 10 seconds) when bug was occuring.
Why it's 'OEM'?
Because as we see in that file - there are a call to a system prompt (cmd shell), and my system's cmd shell has encoding 'OEM'.
I'll point that this is a workaround, not a proper solution, but due to a lack of time and interest figuring out which of sides this bug belongs to (pycharm or pipenv) I wont continue to a proper solution.
Everytime I run docker-compose up on my machine (macOS 10.13.5, latest docker version) I get this error
Traceback (most recent call last): File "docker-compose", line 6, in
File "compose/cli/main.py", line 71, in main File
"compose/cli/main.py", line 124, in perform_command File
"compose/cli/command.py", line 41, in project_from_options File
"compose/cli/command.py", line 126, in get_project File
"compose/project.py", line 96, in from_config File
"compose/network.py", line 320, in get_networks File
"compose/network.py", line 125, in true_name File
"compose/network.py", line 146, in _set_legacy_flag File
"compose/network.py", line 106, in inspect File
"site-packages/docker/utils/decorators.py", line 19, in wrapped File
"site-packages/docker/api/network.py", line 211, in inspect_network
File "site-packages/docker/utils/decorators.py", line 46, in inner
File "site-packages/docker/api/client.py", line 194, in _get File
"site-packages/requests/sessions.py", line 521, in get File
"site-packages/requests/sessions.py", line 494, in request File
"site-packages/requests/sessions.py", line 424, in prepare_request
File "site-packages/requests/utils.py", line 195, in get_netrc_auth
File "netrc.py", line 33, in init File "netrc.py", line 42, in
_parse File "shlex.py", line 105, in get_token File "shlex.py", line 136, in read_token File
"/Users/distiller/compose-osx-release/compose/venv/lib/python3.6/codecs.py",
line 321, in decode UnicodeDecodeError: 'utf-8' codec can't decode
byte 0x80 in position 33: invalid start byte
Ok so apparently there is a problem with the current version of docker-compose for macOS... It's just my guess, but anyhow here is how I solved it
curl -L https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
Then restarted the terminal
I ran into this same issue and this may also be related to your .env files.
Ensure that your .env files are UTF-8.
sudo apt install moreutils
isutf8 yourfile.env
If isutf8 returns no output it's likely a valid UTF-8 file.
Additionally, check the contents of the .env file you're referencing in your docker-compose.yml. Any incorrectly decrypted secrets/values you may be using locally can cause this problem too.
If in doubt, clear the env file and readd lines until you hit the error.
I have 2 ideas:
1. try to reinstall your python
2. use not the latest docker version, but the latest stable
What worked for me was creating an empty .env file in the directory I run docker-compose in (encoded as UTF-8).
you need to go to the pycharm env file, double click it and install the python env file. Then run the code [docker-compose up airflow-init] again, it'll work.
everyone.
I try to study django and python. But I have a problem. In my book there is such string:
django-admin.py startproject megaproject
When I try to execute this code, I get next message:
D:\Job\РАН\База Данных. Сомнология>django-admin.py startproject megaproject
Traceback (most recent call last):
File "C:\Python27\Scripts\django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
353, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 357,
in run_from_argv
self.stderr.write('%s: %s' % (e.__class__.__name__, e))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 8: ordinal
not in range(128)
This code work in english directory. But I have russian directory next type:
D:\Job\РАН\База Данных. Сомнология
This problem appear due differences encoding into python and cmd. And I cannot conform them. I try change coding into command line and into python. But I have no results. When I change encoding into cmd, I get bad string with strange symbols. When I add concretly encoding in title python-file, I have no result too.
The windows django can not work with Russian catalogs.