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:
Related
installing cryptography:
successfully installed gcc, libffi-devel on python 2.7.
When i try executing the script getting the below error:
from cryptography.fernet import Fernet
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib64/python2.7/site-packages/cryptography-2.4.2-py2.7-linux-x86_64.egg/cryptography/fernet.py", line 17, in
from cryptography.hazmat.primitives import hashes, padding
File "/usr/lib64/python2.7/site-packages/cryptography-2.4.2-py2.7-linux-x86_64.egg/cryptography/hazmat/primitives/padding.py", line 13, in
from cryptography.hazmat.bindings._padding import lib
AttributeError: _init_cffi_1_0_external_module
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 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
I am new to python and I am trying to work on a project with deep learning and want to use graphlab library. I use sublime text for coding on windows 10. My code is only this line:
import graphlab
I get this error msg:
Traceback (most recent call last):
File "test.py", line 1, in
import graphlab
File "graphlab__init__.py", line 59, in
from graphlab.data_structures.sgraph import Vertex, Edge
File "graphlab\data_structures__init__.py", line 25, in
from . import sframe
File "graphlab\data_structures\sframe.py", line 19, in
from ..connect import main as glconnect
File "graphlab\connect\main.py", line 26, in
from ..cython.cy_unity import UnityGlobalProxy
ImportError: No module named cy_unity
Try using graphlab.get_dependencies() in your interpreter.
I think I made a mistake when installing, i re-installed and it worked fine. Thanks anyway
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.