i'm working with SharpDevelop 3.2.0, IronPython 2.6.1 for .Net4.
To have access to the sqlite3 functionality using this module for IronPython: IronPython.SQLite
My program is an GUI application and access an sqlite database. When starting the program via ipy.exe interpreter from IronPython everything (included the database access) works just perfect.
But if i try to start the program i compiled with SharpDevelop to an executable, i get the exception:
IronPython.Runtime.Exceptions.ImportException: No module named _sqlite3
The reason for this exception is located in dbapi2.py:
from _sqlite3 import *
On IronPython console, i can import _sqlite3 and use it as intended.
I already gave SharpDevelop the paths to the sqlite3 module, but there is no file named _sqlite3 anywhere in IronPython or the sqlite3-module folder.
Please tell me what could cause this trouble when building a compiled version of my program.
Thank you very much.
There is no _sqlite3
file anywhere; IronPython.Sqlite.dll provides a module called _sqlite3
.
If you follow the website instructions and put IronPython.Sqlite.dll in the DLLs folder, that's probably why it doesn't work under SharpDevelop. When running ipy.exe, it implicitly adds a reference to any DLL in the DLLs folder. When SharpDevelop builds an executable, it's a small stub that runs IronPython, but it doesn't know about any installed versions of IronPython and thus won't load anything from the DLLs folder.
Your best is to modify your main script to include
import clr
clr.AddReference("IronPython.SQLite.dll")
and then make sure that IronPython.SQLite.dll is in the same directory as the exe. This is my preferred option anyway, and I should add it to the instructions when I get a chance.