473,705 Members | 3,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQLite import fails sometimes ?

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.p y", line 322, in Exec
self.Generate_O utput_Signals ()
File "bricks\brick_d Base.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
5 5205
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.p y", line 322, in Exec
self.Generate_O utput_Signals ()
File "bricks\brick_d Base.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.__fi le__
'c:\\python25\\ DLLs\\_sqlite3. pyd'
=== end ===
Jun 27 '08 #2
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.p y", line 322, in Exec
self.Generate_O utput_Signals ()
File "bricks\brick_d Base.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.__fil e__
'c:\\python25\\ DLLs\\_sqlite3. pyd'
=== end ===
==== looks identical to me ====
C:\Documents and Settings\Admini strator>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.__fi le__
'P:\\Python\\DL Ls\\_sqlite3.py d'
==== end =====

Any other suggestions ?

thanks,
Stef

--
http://mail.python.org/mailman/listinfo/python-list
Jun 27 '08 #3
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
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_Work s\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
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_Work s\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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2477
by: achan | last post by:
I recently bought a new PC runnning in XP. I downloaded and installed PySqlite 0.4.3win32 for Python 2.3. My Python23/Lib/Site-Packages/SQlite/ now has files __init__.py and main.py. However, running a script with "import sqlite" generated an error - ImportError: No module named sqlite. I tried running the file with PythonWin and Boa, but both failed.
1
1337
by: Laszlo Zsolt Nagy | last post by:
Hello all, Can anyone explain this: C:\Python\Projects\DbDesigner>python Python 2.3.4 (#53, May 25 2004, 21:17:02) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from Db.FieldTypes import IdentifierFieldType >>> from Db.FieldTypes import *
0
1411
by: Laszlo Zsolt Nagy | last post by:
> exarkun@boson:~$ cat foo.py > x = 10 > __all__ = > exarkun@boson:~$ cat bar.py > x = 20 > __all__ = > exarkun@boson:~$ python -c "from foo import *; print x" > Traceback (most recent call last): > File "<string>", line 1, in ? > TypeError: attribute name must be string
0
1264
by: comp.lang.php | last post by:
<? header('Pragma: no-cache'); // ENSURE CLIENT-SIDE CACHE FLUSHING $url = "$projectURLPath/index.php"; if ($_REQUEST) $url .= '?logoutMsg='. urlencode($_REQUEST); if ($willAuthenticate && $willUseSSL) { $dest = 'https://' . $_SERVER . $url; } elseif ($willBasicAuthenticate && $willUseSSL) { $dest = 'https://EnterYourUserName:EnterPassword@' . $_SERVER . $url;
0
3264
by: mrjaxon | last post by:
Basically the issue is, when the XSL style sheet is loaded by URI it is cool but when the exact same style sheet loaded by it's contents the load fails (for this particular style sheet). Because our sheets are kept in a DB, loading by content is preferable. Content based load code: Stream xslStream = new MemoryStream(xslString); XmlReader xslTextReader = XmlReader.Create(xslStream); compliedXsl.Load(xslTextReader);
10
1451
by: defn noob | last post by:
i unzipped and put the folder in site-packages. when i run setup.py install nothing happens. when i do import pp from shell it complains it doesnt exist. isnt placing the folder in site-packages enough?
0
1211
by: Stef Mientki | last post by:
hello, I'm running Python 2.5 and want my programs to run at least under Windows and Linux (preferable also Mac). So I guess I should always use relative paths. From most modules I can call a global function, that should import a dictionary from path deeper than the module itself. The import is done in the global function. In that global function, I get the modules path by
0
1501
by: Gabriel Genellina | last post by:
En Sat, 18 Oct 2008 05:52:04 -0300, Stef Mientki <stef.mientki@gmail.com> escribió: Why don't you let the caller tell you its own location, using __file__? The above code is too much magic for me. Yes.
0
1484
by: tvnaidu | last post by:
database file gets created using below sql file, then lua script calls "db.import config_ascc", then I get errors says "insert table failed for eventLog", below are my sql file entry, config file, also import and saveTable function, any idea what is wrong, why I get error?. thanks in advance. system.sql file ========== CREATE TABLE eventLog ( component text NOT NULL,
0
8689
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7893
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5933
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4439
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4703
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3137
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2486
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2081
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.