Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Trouble converting flask python script #655

Open
Tsjippy opened this issue Nov 4, 2024 · 0 comments
Open

Trouble converting flask python script #655

Tsjippy opened this issue Nov 4, 2024 · 0 comments

Comments

@Tsjippy
Copy link

Tsjippy commented Nov 4, 2024

I have a 'server.py' script that runs a server and a webpage using flask.
I am trying to move that to pyscript but don't know completely how to do that.

See the source code here

I just copied all the files to the pyscript folder, moved the dependent file 'sql_functions.py' to the modules folder, and added a requirements.txt with flask as content.

But trying to run the script gives me these errors:

Exception in </config/pyscript/server.py> line 30: @app.route('/', methods=['GET']) ^ AttributeError: 'EvalFunc' object has no attribute '__name__'
Exception in </config/pyscript/server.py> line 2: import sql_functions ^ ModuleNotFoundError: No module named 'sql_functions'
Exception in </config/pyscript/server.py> line 35: @app.route('/', methods=['GET']) ^ AttributeError: 'EvalFunc' object has no attribute '__name__'
Exception in </config/pyscript/modules/sql_functions.py> line 11: base_path = os.path.dirname(os.path.realpath(__file__))+'/' ^ NameError: name '__file__' is not defined

Any help appreciated

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant