Transcrypt is a compiler that translates Python into JavaScript ahead-of-time and dont working with sqlite3?

388 views Asked by At

I try to execute command python -m transcrypt -b -m -n mr_index.py and failed on code's string "import sqlite3". Why?

C:\Users\Legion\Downloads\meterrhyme-master>python -m transcrypt -b -m -n mr_index.py
Transcrypt (TM) Python to JavaScript Small Sane Subset Transpiler Version 3.7.16 Copyright (C) Geatec Engineering. License: Apache 2.0
Saving target code in: C:/Users/Legion/Downloads/meterrhyme-master/_target_/org.transcrypt._runtime_.js
Error while compiling (offending file last):
File 'mr_index', line 5, namely:
Import error, can't find any of: C:/Users/Legion/Downloads/meterrhyme-master/sqlite3.py
C:/Users/Legion/Downloads/meterrhyme-master/sqlite3.js
C:/Users/Legion/AppData/Local/Programs/Python/Python38-32/lib/site-packages/transcrypt/modules/sqlite3.py
C:/Users/Legion/AppData/Local/Programs/Python/Python38-32/lib/site-packages/transcrypt/modules/sqlite3.js
C:/Users/Legion/Downloads/meterrhyme-master/sqlite3.py
C:/Users/Legion/Downloads/meterrhyme-master/sqlite3.js
C:/Users/Legion/AppData/Local/Programs/Python/Python38-32/sqlite3.py
C:/Users/Legion/AppData/Local/Programs/Python/Python38-32/sqlite3.js
C:/Users/Legion/AppData/Local/Programs/Python/Python38-32/lib/site-packages/sqlite3.py
C:/Users/Legion/AppData/Local/Programs/Python/Python38-32/lib/site-packages/sqlite3.js
Aborted

1

There are 1 answers

0
John S On

Transcrypt can only transpile pure Python code and as such wont work with most 3rd party libraries that utilize C extensions. It is intended to act as a bridge between Python code and the JavaScript world, mainly to create code that will run in a web browser and be able to utilize JavaScript libraries.

If you are using Node to run the transpiled Python code, you can use the JavaScript SQLite library instead, but still code to it using Python.