By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,986 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,986 IT Pros & Developers. It's quick & easy.

SQLite import fails sometimes ?

P: n/a
hello,

The import statement "import sqlite3" gives the error given below.
In simple programs, the import statement (sometimes) succeed,
and I can indeed access the database.
So I guess there is some conflict with another part of my program,
but as the program is rather large (and dynamic) it's not easy to
isolate the problem.
Does anyone has a clue how to trace this kind of problem ?

thanks,
Stef

Traceback (most recent call last):
File "bricks\brick.py", line 322, in Exec
self.Generate_Output_Signals ()
File "bricks\brick_dBase.py", line 61, in Generate_Output_Signals
import sqlite3
File "P:\Python\lib\sqlite3\__init__.py", line 24, in <module>
from dbapi2 import *
File "P:\Python\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: Invalid access to memory location.
Jun 27 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Stef Mientki wrote:
hello,

The import statement "import sqlite3" gives the error given below.
In simple programs, the import statement (sometimes) succeed,
and I can indeed access the database.
So I guess there is some conflict with another part of my program,
but as the program is rather large (and dynamic) it's not easy to
isolate the problem.
Does anyone has a clue how to trace this kind of problem ?

thanks,
Stef

Traceback (most recent call last):
File "bricks\brick.py", line 322, in Exec
self.Generate_Output_Signals ()
File "bricks\brick_dBase.py", line 61, in Generate_Output_Signals
import sqlite3
File "P:\Python\lib\sqlite3\__init__.py", line 24, in <module>
Is P: a network drive? If not, what is it?
I presume from the fact that the next part of the path is not
\Python25\Lib that you have not performed a default installation; other
than the changes to the path name, what else have you done?
What version of Python are you using? What version of Windows?
from dbapi2 import *
File "P:\Python\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: Invalid access to memory location.
Looks like the problem could be with your copy of _sqlite3.pyd (pyd ==
Python DLL)

Try why I did below and tell us how far you got.
Cheers,
John

=== try this ===
C:\junk>python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>from _sqlite3 import *
import _sqlite3
_sqlite3.__file__
'c:\\python25\\DLLs\\_sqlite3.pyd'
=== end ===
Jun 27 '08 #2

P: n/a
John Machin wrote:
Stef Mientki wrote:
>hello,

The import statement "import sqlite3" gives the error given below.
In simple programs, the import statement (sometimes) succeed,
and I can indeed access the database.
So I guess there is some conflict with another part of my program,
but as the program is rather large (and dynamic) it's not easy to
isolate the problem.
Does anyone has a clue how to trace this kind of problem ?

thanks,
Stef

Traceback (most recent call last):
File "bricks\brick.py", line 322, in Exec
self.Generate_Output_Signals ()
File "bricks\brick_dBase.py", line 61, in Generate_Output_Signals
import sqlite3
File "P:\Python\lib\sqlite3\__init__.py", line 24, in <module>

Is P: a network drive? If not, what is it?
P is just a normal local drive,
I presume from the fact that the next part of the path is not
\Python25\Lib that you have not performed a default installation;
other than the changes to the path name, what else have you done?
Indeed, the only thing I've changed is the pathname.
I also installed

* install python 2.5.2 msi
* install numpy 1.0.4
* install scipy 0.6.0
* install wxPython + docs-demo 2.8.7.1 unicode
* install MatPlotLib 0.91.2
* install Pygame + docs 1.8.0
* install SendKeys 0.3
* install PyScripter 1.7.2 , updated to 1.9.9.1 !!!
* install Rpyc 3.0
* install ConfigObj 4.5.2 , unpack in sitelibs and run "python
setup.py install"

I don't know if this matters, but I also use sqlite3 from other than
Python programs.
What version of Python are you using? What version of Windows?
Windows-XP - sp2
>
> from dbapi2 import *
File "P:\Python\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: Invalid access to memory location.

Looks like the problem could be with your copy of _sqlite3.pyd (pyd ==
Python DLL)

Try why I did below and tell us how far you got.
Cheers,
John

=== try this ===
C:\junk>python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>from _sqlite3 import *
import _sqlite3
_sqlite3.__file__
'c:\\python25\\DLLs\\_sqlite3.pyd'
=== end ===
==== looks identical to me ====
C:\Documents and Settings\Administrator>python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>from _sqlite3 import *
import _sqlite3
_sqlite3.__file__
'P:\\Python\\DLLs\\_sqlite3.pyd'
==== end =====

Any other suggestions ?

thanks,
Stef

--
http://mail.python.org/mailman/listinfo/python-list
Jun 27 '08 #3

P: n/a
Stef Mientki wrote:
I don't know if this matters, but I also use sqlite3 from other than
Python programs.
You have an instance of sqlite3.dll in P:\Python\DLLs for use with
Python, and (I guess) you have another instance of sqlite3.dll somewhere
else, for use "from other than Python programs". Are they the same
version? If not, this may be the problem. Start up your other
application, then try to import sqlite3 from Python. If this is the
problem, and you must be able to run both apps simultaneously, you will
probably need to update one or the other.

Cheers,
John
Jun 27 '08 #4

P: n/a
John Machin wrote:
Stef Mientki wrote:
>I don't know if this matters, but I also use sqlite3 from other than
Python programs.

You have an instance of sqlite3.dll in P:\Python\DLLs for use with
Python, and (I guess) you have another instance of sqlite3.dll
somewhere else, for use "from other than Python programs". Are they
the same version? If not, this may be the problem. Start up your other
application, then try to import sqlite3 from Python. If this is the
problem, and you must be able to run both apps simultaneously, you
will probably need to update one or the other.

Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list
thanks John,

I think I hit the problem, ;-)
but I don't have a solution yet :-(

After creating the simplest program that did work :

import sqlite3

I started adding every import statement used in my program,
until the program crashed,
and here is the simplest program that crashes:

from scipy import *
import sqlite3

Traceback (most recent call last):
File "D:\Data_Python\P24_PyLab_Works\module1.py", line 2, in <module>
import sqlite3
File "P:\Python\lib\sqlite3\__init__.py", line 24, in <module>
from dbapi2 import *
File "P:\Python\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: Invalid access to memory location.

Any solutions ?
(btw I need to do the *-import, because I create an easy user
environment to do math and physics)

thanks,
Stef Mientki

Jun 27 '08 #5

P: n/a
hello,

through the scipy group I found a solution (no explanation yet),

import sqlite3
from scipy import *

solves the problem.

cheers,
Stef

Stef Mientki wrote:
John Machin wrote:
>Stef Mientki wrote:
>>I don't know if this matters, but I also use sqlite3 from other than
Python programs.

You have an instance of sqlite3.dll in P:\Python\DLLs for use with
Python, and (I guess) you have another instance of sqlite3.dll
somewhere else, for use "from other than Python programs". Are they
the same version? If not, this may be the problem. Start up your
other application, then try to import sqlite3 from Python. If this is
the problem, and you must be able to run both apps simultaneously,
you will probably need to update one or the other.

Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list
thanks John,

I think I hit the problem, ;-)
but I don't have a solution yet :-(

After creating the simplest program that did work :

import sqlite3

I started adding every import statement used in my program,
until the program crashed,
and here is the simplest program that crashes:

from scipy import *
import sqlite3

Traceback (most recent call last):
File "D:\Data_Python\P24_PyLab_Works\module1.py", line 2, in <module>
import sqlite3
File "P:\Python\lib\sqlite3\__init__.py", line 24, in <module>
from dbapi2 import *
File "P:\Python\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: Invalid access to memory location.

Any solutions ?
(btw I need to do the *-import, because I create an easy user
environment to do math and physics)

thanks,
Stef Mientki

Jun 27 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.