Skip to content

Trouble converting flask python script #655

Open
@Tsjippy

Description

@Tsjippy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions