Use SQLite3 and IronPython 2.6 for .Net4

I am using SharpDevelop 3.2.0, Iron Python 2.6.1 for .Net4.

To use this module to access IronPython, please visit the sqlite3 function:
IronPython.SQLite

My program is a GUI application and accesses a sqlite database. When the program is launched from IronPython through the ipy.exe interpreter (including database access) it works perfectly.

p>

However, if I try to start a program that I use SharpDevelop to compile into an executable file, I get an exception:

IronPython.Runtime.Exceptions. ImportException:
No module named _sqlite3

The reason for this exception is located in dbapi2.py:

from _sqlite3 import *

On the IronPython console, I can import _sqlite3 and use it as expected.

I have provided SharpDevelop with the path of the sqlite3 module, but in IronPython Or there is no file named _sqlite3 in the sqlite3-module folder.

Please tell me what will happen when building the compiled version of my program.

Thank you very much .

There is no _sqlite3 file anywhere; IronPython.Sqlite.dll provides a file named _ The module of sqlite3.

If you follow the website instructions and put IronPython.Sqlite.dll in the DLLs folder, this may be the reason why it does not work under SharpDevelop. Run ipy.exe , It will implicitly add a reference to any DLL in the DLLs folder. When SharpDevelop builds an executable file, it is a small stub that runs IronPython, but it does not know about any installed IronPytho n version, so nothing will be loaded from the DLLs folder.

You’d better modify the main script to include

import clr
clr .AddReference("IronPython.SQLite.dll")

Then make sure that IronPython.SQLite.dll is in the same directory as the exe. Anyway, this is my preferred option and I should add it when I have the opportunity Add to the description.

I am using SharpDevelop 3.2.0, Iron Python 2.6.1 for .Net4.

To use this Module to access IronPython, please access the sqlite3 function:
IronPython.SQLite

My program is a GUI application and accesses the sqlite database. When the program is launched from IronPython through the ipy.exe interpreter (including the database Access) works perfectly.

However, if I try to start a program that I use SharpDevelop to compile into an executable file, I get an exception:

IronPython.Runtime.Exceptions.ImportException:
No module named _sqlite3

The reason for this exception is located in dbapi2.py:

from _sqlite3 import *

On the IronPython console, I can import _sqlite3 and use it as expected.

I have provided it to SharpDevelop I have found the path of the sqlite3 module, but there is no file named _sqlite3 in the IronPython or sqlite3-module folder.

Please tell me what will happen when I build the compiled version of my program.< /p>

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, it may be that it is in the S The reason why harpDevelop does not work. When running ipy.exe, it implicitly adds a reference to any DLL in the DLLs folder. When SharpDevelop builds an executable file, it is a small stub to run IronPython, but it does not Know any installed version of IronPython, so nothing will be loaded from the DLLs folder.

You’d better modify the main script to include

import clr 
clr.AddReference("IronPython.SQLite.dll")

Then make sure that IronPython.SQLite.dll is in the same directory as the exe. Anyway, this is my preferred option, I should be in Add it to the description when you have the opportunity.

Leave a Comment

Your email address will not be published.