flet-dev / serious-python

Python runtime for Flutter apps
Apache License 2.0
212 stars 22 forks source link

Multiprocessing and Flask #42

Open InfinitySoftware-House opened 1 year ago

InfinitySoftware-House commented 1 year ago

Hi! I'm running a code using Flask as "web server" and multiprocessing to use all the CPU's cores. It gave me this error when I am creating a Pool: PermissionError: [Errno 1] Operation not permitted How can I run this flask server using something like sudo or admin?

FeodorFitsner commented 1 year ago

I assume doing multiprocessing involves creating new processes with Python interpreter. In general, spawning of new processes is not allowed on iOS and Android.

InfinitySoftware-House commented 12 months ago

I'm developing an app only for Windows and macOS now. I am testing it on macOS system and gave me this error.

FeodorFitsner commented 12 months ago

In macos/Runner/Release.entitlements (and macos/Runner/DebugProfile.entitlements) of Flutter app make sure sandbox mode is disabled:

    <key>com.apple.security.app-sandbox</key>
    <false/>
InfinitySoftware-House commented 12 months ago

Thank you! Now It is working!

HighLiuk commented 6 months ago

@FeodorFitsner hot reload does not work though. If I reload, it quits:

Restarted application in 319ms. 127.0.0.1 - - [25/May/2024 19:21:53] "GET / HTTP/1.1" 200 - flutter: Start unpacking app archive flutter: Finished unpacking application archive. 2024-05-25 19:21:54.006 serious_python_example[98072:11620343] Swift runPython(appPath: /Users/highliuk/Library/Caches/serious_python_example-1.0.0-1/app/main.pyc, modulePaths: []) Lost connection to device. Exited.

FeodorFitsner commented 6 months ago

serious_python does not support/provide hot reload. It's part of Flet framework CLI.