I can import asgi_redis on my local server fine but I get the error in the title when i try to import asgi_redis on my production server (heroku, using heroku run bash). Both have the same version of asgi_redis.
Here is the full traceback:
>>> import asgi_redis
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/app/.heroku/python/lib/python2.7/site-packages/asgi_redis/__init__.py", line 1
, in <module>
from .core import RedisChannelLayer
File "/app/.heroku/python/lib/python2.7/site-packages/asgi_redis/core.py", line 10, i
n <module>
from redis._compat import b
ImportError: No module named _compat
Does anyone know what is going on here? Thanks in advance.
I also have redis installed, redis 2.6.0, FWIW
local server had latest redis, production did not. upgraded redis on production and error is gone
Related
I cannot import mysql.connector in python 2.7.12. I cannot upgrade my python version, because some other servers are running on it.
>>> import mysql.connector
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\mysql\connector\__init__.py", line 53, in <module>
from .connection import MySQLConnection
File "C:\Python27\lib\site-packages\mysql\connector\connection.py", line 518
f"This connection is using {tls_version} which is now "
^
SyntaxError: invalid syntax
This is the error I am getting even though I installed mysql-connector-python. Can someone please help me with this?
As I stated in my comment, you're most likely using a more recent mysql-connector-python.
From the list of version in PyPI, this might be the last one that supports 2.7:
https://pypi.org/project/mysql-connector-python/8.0.23/
This docs discusses that 2.7 was removed in 8.0.24:
Hi I am trying to download PyUserInput, I downloaded it using pip and there were no errors. When I try to import it into a file in give me an error which I do not understand. I have a basic understanding of python and pip.Any help will be much appreciated.I have pasted the error I get below.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from pymouse import PyMouse
File "/usr/local/lib/python2.7/dist-packages/pymouse/__init__.py", line 41, in <module>
from .x11 import PyMouse, PyMouseEvent
File "/usr/local/lib/python2.7/dist-packages/pymouse/x11.py", line 16, in <module>
from Xlib.display import Display
File "/usr/local/lib/python2.7/dist-packages/Xlib/display.py", line 26, in <module>
from six import create_unbound_method
ImportError: cannot import name create_unbound_method
Thanks
I had the same problem on old raspberry pi image and upgrading six solved the issue for me:
sudo pip install six --upgrade
I installed locustio
pip install locustio
Once installed, I tried running
locust --help
But I get the following error:
Traceback (most recent call last):
File "/home/vagrant/.virtualenvs/chalktalk-legacy/bin/locust", line 7, in <module>
from locust.main import main
File "/home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/locust/__init__.py", line 1, in <module>
from core import HttpLocust, Locust, TaskSet, task
File "/home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/locust/core.py", line 1, in <module>
import gevent
File "/home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/gevent/__init__.py", line 49, in <module>
from gevent.hub import get_hub, iwait, wait, PYPY
File "/home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/gevent/hub.py", line 11, in <module>
from greenlet import greenlet, getcurrent, GreenletExit
ImportError: /home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/greenlet.so: undefined symbol: _PyTrash_thread_deposit_object
Is the solution to rebuild gevent? If so, how does one go about rebuilding greenlet in debian virtualenv with python 2.7.3? If not, how do I solve this issue without upgrading python?
I am getting following error
D:\pythongui>C:\Python27\python.exe D:/pythongui/controller/MainController.py
Traceback (most recent call last):
File "D:/pythongui/controller/MainController.py", line 5, in <module>
from view.MainView import Launcher
ImportError: No module named view.MainView
when I am executing the following command in terminal
C:\Python27\python.exe D:/pythongui/controller/MainController.py
But the same code is working in pycharm without any error.
My Directory structure is as follows :
I have tried following code
import GetMyIp as getMyIP
import sys
sys.path.append("view/MainView")
import Server as server
import view.MainView
I am working through the PYcharm tutorial, which sets up a polling site, as my first Python/Django project. I am new to this so if I am asking silly questions I apologize in advance. In the admin.py file the following import is not working:
from MyDjangoApp.polls.models import Poll, Choice
I have specified the environment variable as I found in other posts to
DJANGO_SETTINGS_MODULE MyDjangoApp.settings
with MyDjangoApp being my project name and MyDjangoApp.settings as the value in the Edit Configurations tab.
I also tried to follow the lightbulb suggestion to install package models but when I do that I get the following error:
Error occurred when installing packages.
The following command was executed:
packaging_tool.py install --build-dir /tmp/pycharm packaging1986982253689628475.tmp
models
The error output of the command:
Downloading/unpacking models
Downloading models-0.9.3.tar.gz
Running setup.py egg_info for package models
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/tmp/pycharm-packaging1986982253689628475.tmp/models/setup.py", line 25, in
<module>
import models
File "models/__init__.py", line 24, in <module>
from props import *
File "models/props.py", line 23, in <module>
import yaml
ImportError: No module named yaml
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/tmp/pycharm-packaging1986982253689628475.tmp/models/setup.py", line 25, in
<module>
import models
File "models/__init__.py", line 24, in <module>
from props import *
File "models/props.py", line 23, in <module>
import yaml
ImportError: No module named yaml
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pycharm
-packaging1986982253689628475.tmp/models
Storing complete log in /home/andrew/.pip/pip.log
I am not sure how to proceed. I have seen a decent amount of suggestions but they either don't work or I'm not doing it correctly. If anyone has any suggestions I would greatly appreciate it. I have been banging my head against this wall most of the day today and I would really like to be able to move forward. Thanks is advance for anyone willing to help out a newbie.
In polls/admin.py do from models import Poll, Choice - this is presuming you have a models.py file next to admin.py.