RapydScript
RapydScript copied to clipboard
Cannot resolve python imports
The compilation failed on importing local python module that exists in the same folder as the main file:
import config
The shown error is:
[ImportError: Failed Import: 'config' module doesn't exist in any of the import directories: ./exampleservice-master, ./exampleservice-master/node_modules/rapydscript/src/lib] {
message: "Failed Import: 'config' module doesn't exist in any of the import directories: ./exampleservice-master, ./exampleservice-master/node_modules/rapydscript/src/lib",
filename: './exampleservice-master/statelesshosting.py',
readfile_error: undefined
}
When I copied the config.py file into the src/lib folder it didn't find it too.
Use .pyj, not .py
And how do I import standard python libraries that are installed by
pip install -r requirements.txt?
It is impossible, but you can try Transcrypt or Brython
Is there a way to make script don't fail on missing imports? You could create mock modules with mock classes.
RS is mainly intended for writing Javascript using Python syntax, it is not compatible with Python, it just looks like Python, but it is javascript. So, explain in more detail what are you trying to do?
I would like to convert python project to JS
What does your project look like? Should it be running in a browser or on Node.js? If it is large enough, then it is better to take a look at Transcrypt, because to convert it to RS you have to fix each file yourself. There are some fundamental differences, such as Truthiness/Falseness: [], {}- are considered as true in RS
It is a python backend server with bottle.py that should run like Node.js with express.js.
I'm not looking for a complete solution. Just translating the syntax would be enough.