My problem is when I running program from python. It said that "Import error : No module named sillyLibrary". Can you help me to solve this problem?
Related
getting the following import error in my Django(graphene) application, is there a workaround ?
from graphene.utils.str_converters import to_camel_case, to_const
ImportError: cannot import name 'to_const'
Error : ? the above error results from package upgrade, that causes mismatches in dependencies
Solution : ? To clear the error above i downgraded the following packages to the versions shown below:
aniso8601==7.0.0
graphene==2.1.8
graphql-core==2.3.2
graphql-relay==2.0.1
and the error cleared.
Looks to me like to_const does not exist in the module str_converters. Which is why you are getting this error.
Source: https://github.com/graphql-python/graphene/blob/master/graphene/utils/str_converters.py
Currently I have migrated my python2 django project to python 3 & after conversion to py3 I am getting below kind of error for below code.
from hubarcode.code128 import Code128Encoder
encoder = Code128Encoder(pur_num, {'is_reliable': False})
Trackeback is as below.
from hubarcode.code128 import Code128Encoder
File "D:\my_project\venv\lib\site-packages\hubarcode\code128__init__.py", line 16, in
from textencoder import TextEncoder
ModuleNotFoundError: No module named 'textencoder'
I have tried to search for solution online on google but not able to solve it.
Any suggestions ?
Thanks.
I am able to solve issue by using pyStrich.
First you need to install pyStrich using pip3 install pyStrich and after thatn
What you need to do is just replace from hubarcode.code128 import Code128Encoder with
from pystrich.code128 import Code128Encoder.
I hope it may help others who have been facing same kind of problem.
pip freeze will show it if you have this module installed in your venv
pip install textencoder to resolve problem
In python interpreter mode , i tried "import csv". It is working fine.
But when i import csv by using my python script , i am getting "No modeule name csv"
Please help me in solving this.
I am making some tests to learn using Cython. I am using pyximport to import a Cython module into a Python script and I found the following problem:
If I execute the script while working in one directory, building the module fails. The error message says:
from . import Pipeline
ImportError: Building module mymodule failed: ["ImportError: Building module _laplace failed: ['ImportError: cannot import name Pipeline\n']\n"]
On the contrary, if I copy my Python script and the Cython module in a subfolder, everything works fine.
Can anyone tell me why this is happening?
Everything works as supposed to on the Django development server. In Apache, the django app also works except when matplotlib is used. Here's the error I get:
No module named multiarray.
Exception Type: ImportError
Exception Value: No module named multiarray
Exception Location: /usr/share/pyshared/numpy/core/numerictypes.py in <module>, line 81
Python Executable: /usr/bin/python
Python Version: 2.6.4
From the python shell, both statements work: import numpy.core.multiarray and import multiarray. Any ideas?
Thanks
As I'm looking over the numpy files, I found the multiarray module, which has an extension of 'so'. My guess, is that mod_python is not reading these files.
Problem solved. Here's what I did.
First of all, before I was getting the import error:
"No module named multiarray."
I was getting an error like this:
": Failed to create /some/dir/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data"
By adding the pyshared folder to the PythonPath variable, this error went away and I got the import error.
So here's how I fixed it:
Removed the pyshared folder from the PythonPath variable.
Before importing the matplotlib module, add these lines:
import os
os.environ['HOME']='/some/writable/dir'
Next, before import matplotlib.pyplot or pylab, add these lines:
import matplotlib
matplotlib.use('Agg')
# 'Agg' or whatever your backend is.
This is documented here.
That's is! It's working on python2.5 for me now. But I believe it'll work on 2.6 as well.
On Win32 I solved a similar problem (not being able to load pyd modules through ISAPI_WSGI (IIS)) by downgrading from py2.6.5 to py2.5. It seems like this might be a Python bug that has been re-introduced. See for example this discussion.