Hello,
Since I use my new Revit 2020 this script is unable to import sqlite3
Here is the issue:
Avertissement:IronPythonEvaluator.EvaluateIronPythonScript l’opération a échoué.
Traceback (most recent call last):
File “”, line 10, in
File “C:\Program Files\Autodesk\Revit 2020\AddIns\DynamoForRevit\IronPython.StdLib.2.7.8\sqlite3_init_.py”, line 32, in
File “C:\Program Files\Autodesk\Revit 2020\AddIns\DynamoForRevit\IronPython.StdLib.2.7.8\sqlite3\dbapi2.py”, line 28, in
ImportError: No module named _sqlite3
Merci beaucoup !
hi @E_Gonthier974
can you try just the code below and make sure that the dynamo version matches.
-biboy
1 Like
Ok the problem is solved by the install of hotfix 2020.2 to update dynamo to 2.3
Thanks a lot “monsieur” biboy
I’m also having this issue, I’m using :
the project is in Revit 2019.
the error message is:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 22, in
File “C:\Program Files (x86)\IronPython 2.7\Lib\sqlite3_init_.py”, line 32, in
File “C:\Program Files (x86)\IronPython 2.7\Lib\sqlite3\dbapi2.py”, line 27, in
ImportError: No module named _sqlite3
These are the imports I’ve tried with no luck:
import clr
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\DLLs')
clr.AddReference("IronPython.SQLite")
import System
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
import sqlite3
Anyone have any ideas?
EDIT: Same result in Revit 2020 and 21. no problems in 2022 though
for whatever reason adding the full path to the dll reference did the trick, not sure why adding the DLL path wouldn’t work.
adding this got me rolling:
clr.AddReference(r"C:\Program Files (x86)\IronPython 2.7\DLLs\IronPython.SQLite.dll")
1 Like
Sorry I keep bumping this post, so I have finally resolved being able to import sqlite3 for Revit 2020 and '21 through brute force. this is what was needed to get it working for 2019-2022
Revit 2019
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
clr.AddReference(r"C:\Program Files (x86)\IronPython 2.7\DLLs\IronPython.SQLite.dll")
Revit 2020
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
sys.path.append(r'C:\Program Files\Autodesk\Revit 2020\AddIns\DynamoForRevit')
clr.AddReferenceToFile('IronPython.SQLite.dll')
Revit 2021
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
clr.AddReference(r"C:\Program Files (x86)\IronPython 2.7\DLLs\IronPython.SQLite.dll")
Revit 2022
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
clr.AddReferenceToFile('IronPython.SQLite.dll')
I’m using Revit 2022 and this doesn’t work for me. I still get the error.
What I’ve tried:
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\DLLs')
clr.AddReference("IronPython.SQLite.dll")
clr.AddReference("IronPython.SQLite")
import sqlite3
Error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File "<string>", line 71, in <module>
File "C:\Program Files\Autodesk\Revit 2022\AddIns\DynamoForRevit\IronPython.StdLib.2.7.9\sqlite3\__init__.py", line 32, in <module>
File "C:\Program Files\Autodesk\Revit 2022\AddIns\DynamoForRevit\IronPython.StdLib.2.7.9\sqlite3\dbapi2.py", line 28, in <module>
ImportError: No module named _sqlite3
Looked back on the old file I was working on and the only difference is that in the reference I added the full path.
i.e.:
clr.AddReference(r’C:\Program Files\Autodesk\Revit 2022\AddIns\DynamoForRevit\IronPython.SQLite.dll’)
I think I remember it being something small like that. I gave up on sqlite3 with dynamo cause I was having issues with multiple users accessing the db file and would get copies in our shared directory. If I can get the time I will look into it, good luck.
1 Like
I swear I tried that already, but adding the full path worked! Thanks! And thanks for the quick reply too!
Edit: You don’t even need any of the other reference stuff like
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
Just
clr.AddReference(r’C:\Program Files\Autodesk\Revit 2022\AddIns\DynamoForRevit\IronPython.SQLite.dll’)
1 Like