I have a problem, Python doesn't loads the dynamic c library _fileio
~ $ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Could not open PYTHONSTARTUP
IOError: [Errno 2] No such file or directory: '/home/sven/.pythonrc'
>>> import io
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/io.py", line 63, in <module>
import _fileio
ImportError: No module named _fileio
>>>
~ $ locate _fileio
/usr/lib/python2.6/lib-dynload/_fileio.so
~ $ echo $PYTHONPATH
/usr/lib/python2.6/
greetings Sven
Seems like an environment issue, stemming from this line:
IOError: [Errno 2] No such file or directory: '/home/sven/.pythonrc'
To solve this, find .pythonrc and make sure the PYTHONSTARTUP environment variable in your .bashrc file points to this file location. If it is in fact correct, try using the hardcoded path to /home/sven/.pythonrc rather than something such as ~/.pythonrc.
Also, if I remember right, .pythonrc should actually be a *.py file, but that might vary depending on the distribution.
I had this line in my zshrc file
export PYTHONPATH=/usr/lib/python2.6
but ubuntu uses per default Python 2.7.1
As I deleted the line from above, the error message dissapeared.
Sorry, my fault.
Related
Please note that I am using pure Python and not something like Anaconda. Running on a new, updated Windows 10 machine with no virtual environment. After removing all previous Python installations, rebooting and performing a fresh install if Python 3.9.1. I run the python console and type:
import sqlite3
I receive the following error:
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import sqlite3
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\Python39\lib\sqlite3_init_.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Program Files\Python39\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.
I verified that the sqlite3.dll file does exist in C:\Program Files\Python39\DLLs
It was an environment issue. Previous builds (using Kivy) had left .pyd and .pyc files in the application directory and when we ran the application, python would try to load those and the files they reference, rather than using the proper files in the Python39 directory. As soon as we deleted those artifacts, the app ran fine (and sqlite loaded fine).
I have Redhawk 1.9 loaded on a 32-bit CentOS 5 virtual machine. I am trying to run the Redhawk HelloWorld component described here: http://redhawksdr.github.io/Documentation/mainch3.html. I am able to launch and start the component in the eclipse sandbox. I cannot run it from Python though. I get the following error.
Python 2.7.2 (default, Feb 27 2012, 16:40:29)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ossie.utils import sb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/redhawk/core/lib/python/ossie/utils/sb/__init__.py", line 115, in <module>
from domainless import *
File "/usr/local/redhawk/core/lib/python/ossie/utils/sb/domainless.py", line 102, in <module>
from omniORB import CORBA, any
ImportError: No module named omniORB
>>>
Any ideas why it will not work?
You'll probably have to set your PYTHONPATH manually to include the appropriate directory. It looks like Eclipse is doing that for you.
Try running your example as root. If you can successfully run as root, then you have a permission problem on your directories or files. How do you identify the files that have the incorrect permission ? I ran the following command,
strace -o test.out python -c "from ossie.utils import sb"
This command will write the output to test.out. Look for the string "denied", which will identify the file that has the incorrect file permission.
I have a python script for auto mailing when there is a commit in svn, but when i run the script it gives following error :
Traceback (most recent call last):
File "E:\AutoSms-Svn-Repo\test-repo-is\hooks\mailer.py", line 41, in <module>
import svn.fs
File "C:\Python25\Lib\site-packages\svn\fs.py", line 19, in <module>
from libsvn.fs import *
File "C:\Python25\Lib\site-packages\libsvn\fs.py", line 5, in <module>
import _fs
ImportError: DLL load failed: The specified module could not be found.
I even added required path variables for dependent dlls and python path
but still i get this message, even from command prompt
Thanks in advance
I got the same problem instaling subversion under Windows 7 for Python 2.7.
The solution is simple and has been tested. (but hard work to find and analize)
Download and install binaries from Subversion
Make sure thet binaries folder (default: c:\Program Files (x86)\subversion\bin) is in your PATH system
Download Python files from site mentioned in point 1 ( Subversion )
Extract libsvn and svn into Python's site-packages folder
Open cmd (Window's command line console) and type: python. Then try to import svn module.
It should looks like (no error occured):
C:\>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from svn import core
>>>
test#SERVER:~/source/dropbox/.dropbox-dist$ ./dropbox.py
Traceback (most recent call last):
File "./dropbox.py", line 39, in <module>
import urllib
File "/usr/lib/python2.6/urllib.py", line 30, in <module>
from urlparse import urljoin as basejoin
File "/usr/lib/python2.6/urlparse.py", line 84, in <module>
from collections import namedtuple
ImportError: cannot import name namedtuple
dropbox.py has 755 perms. In system I have 2, 2.6 versions of python. Running python2 dropbox.py or python2.6 dropbox.py spits the same error.
and here is dropbox.py file from Dropbox website
Update per comment:
test#SERVER:~/source/dropbox/.dropbox-dist$ python2.6
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections import namedtuple
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name namedtuple
>>>
Looks like there's another module in your Python path named collections (probably collections.py but could also be a folder named collections that has an __init__.py in it) that's preventing the Python 2.6 collections module from being imported. Could be something in the directory that's current when you invoke Python -- check there first. Otherwise try python26 -c 'import sys; print sys.path' to see where Python's looking for modules.
#kindall was right. The .dropbox-dist folder contains collections.so which interferes with the dropbox.py script. Move the file to a different folder. Here is one way:
mkdir cli
mv dropbox.py cli/dropbox.py
cd cli
./dropbox.py --help
Can you try do to
python -c 'import collections; print collections.__file__'
And ensure that the path is /usr/lib/python2.6/collections.pyc. If not, then you have another modules in your PYTHONPATH that replace this one. If yes, then try again by doing:
python -c 'import collections; print dir(collections)'
And show us the result.
Normally, namedtuple have been introduced to 2.6 so...
From command line I can't import appengine, this might be something with my python path:
$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.appengine.ext import db
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "google/appengine/ext/db/__init__.py", line 98, in <module>
from google.appengine.api import datastore
File "google/appengine/api/datastore.py", line 62, in <module>
from google.appengine.datastore import datastore_query
File "google/appengine/datastore/datastore_query.py", line 64, in <module>
from google.appengine.datastore import datastore_index
File "google/appengine/datastore/datastore_index.py", line 60, in <module>
from google.appengine.api import validation
File "google/appengine/api/validation.py", line 51, in <module>
import yaml
ImportError: No module named yaml
>>>
I don't want duplicate installations, I want to point the Python interpretor to where the missing module is. How do I make the interpretor find the app engine modules from the command prompt? In the application these imports are working.
appending:
/usr/local/google_appengine/:/usr/local/google_appengine/lib/:/usr/local/google_appengine/lib/yaml/
to your PYTHONPATH environment variable should do the trick (your SDK location may vary).
For appengine 1.9.6 google has created a new directory "yaml-3.10" that contains the yaml module. I added "[appengine install directory]/google_appengine/lib/yaml-3.10" to PYTHONPATH in my .bashrc file and that solved this problem. BTW: I use Ubuntu 14.04 LTS.
yaml is not installed in your current setup. yaml package is included with google_appengine in the lib folder. the setup.py script in the folder will add the yaml package to your current python
cd google_appengine/lib/yaml
sudo python setup.py install