Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

FletSocketServer Error #2781

Closed
ndonkoHenri opened this issue Mar 2, 2024 · 13 comments
Closed

FletSocketServer Error #2781

ndonkoHenri opened this issue Mar 2, 2024 · 13 comments
Assignees
Labels
bug Something isn't working platform: linux Specific to one or more Linux distributions

Comments

@ndonkoHenri
Copy link
Contributor

@ndonkoHenri , flet pre release has some issues. Not able to run any script. Not even the example code from tutorials.

raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

...

AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'. Did you mean: '_FletSocketServer__receive_loop'?

System: Windows 11, Python=3.11, Conda environment.

Ursprünglich gepostet von @kXborg in #2251 (comment)

@ndonkoHenri
Copy link
Contributor Author

@kXborg thanks for reporting, we will have a look.

@ndonkoHenri
Copy link
Contributor Author

ndonkoHenri commented Mar 3, 2024

@kXborg I am not getting that error with the latest pre (0.21.0dev2459 on macOS+py3.11).
I suggest you retry with the latest once more.

@ndonkoHenri ndonkoHenri added the status: awaiting response Further information is requested label Mar 3, 2024
@ndonkoHenri ndonkoHenri removed the status: awaiting response Further information is requested label Mar 4, 2024
@Marmaduke1st
Copy link

I'm having this problem using Flet 0.21.1

(venv) marmaduke@Urus:~/projects/My-Dev-Site$ flet run -r
/home/marmaduke/.flet/bin/flet-0.21.1/flet/flet: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/home/marmaduke/projects/My-Dev-Site/main.py", line 24, in <module>
    ft.app(target=main)
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/app.py", line 70, in app
    return asyncio.run(
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/app.py", line 207, in app_async
    await conn.close()
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/flet_socket_server.py", line 191, in close
    if self.__receive_loop_task:
AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'. Did you mean: '_FletSocketServer__receive_loop'?

I'm just trying to run boiler plate

import flet as ft

def main(page: ft.Page):
    

    page.add(
        
    )

if __name__ == "__main__":
    ft.app(target=main)

running in ubuntu on WSL

@yashasolutions
Copy link

I have the same error here, running the boilerplate from the docs, and I also get the exact same error as @Marmaduke1st

I am running Python 3.11.7 on Arch, installed flet with pip install, in virtual env, here are the version that got installed:

flet==0.21.1
flet-core==0.21.1
flet-runtime==0.21.1

and error is :

AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'. Did you mean: '_FletSocketServer__receive_loop'?

@ndonkoHenri ndonkoHenri reopened this Mar 7, 2024
@ndonkoHenri ndonkoHenri changed the title Preparing version 0.21.0 FletSocketServer Error Mar 7, 2024
@ndonkoHenri ndonkoHenri added the bug Something isn't working label Mar 7, 2024
@ndonkoHenri
Copy link
Contributor Author

This issue might be Linux-specific.

@ndonkoHenri ndonkoHenri added the platform: linux Specific to one or more Linux distributions label Mar 7, 2024
@Marmaduke1st
Copy link

argeed, works in windows

@yashasolutions
Copy link

This issue might be Linux-specific.

ok so I figure the source of the issue, it's actually the result of library dependencies (in my case it was linked to libmpv, and as far as I can see in @Marmaduke1st case it's linked to a gtk missing dependancy)

I created a separate issue #2823 (because in my case I did have the libraries, just some versioning issue which I fixed some hacky solution.)

@benelliraul
Copy link

I'm having this problem using Flet 0.21.1

(venv) marmaduke@Urus:~/projects/My-Dev-Site$ flet run -r
/home/marmaduke/.flet/bin/flet-0.21.1/flet/flet: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/home/marmaduke/projects/My-Dev-Site/main.py", line 24, in <module>
    ft.app(target=main)
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/app.py", line 70, in app
    return asyncio.run(
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/app.py", line 207, in app_async
    await conn.close()
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/flet_socket_server.py", line 191, in close
    if self.__receive_loop_task:
AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'. Did you mean: '_FletSocketServer__receive_loop'?

I'm just trying to run boiler plate

import flet as ft

def main(page: ft.Page):
    

    page.add(
        
    )

if __name__ == "__main__":
    ft.app(target=main)

running in ubuntu on WSL

I had the same error, in ubuntu, I solved it doing : sudo apt-get install libmpv1

@Marmaduke1st
Copy link

I'll do my best to checking asap

@erivan-as
Copy link

I'm having this problem using Flet 0.21.1

(venv) marmaduke@Urus:~/projects/My-Dev-Site$ flet run -r
/home/marmaduke/.flet/bin/flet-0.21.1/flet/flet: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/home/marmaduke/projects/My-Dev-Site/main.py", line 24, in <module>
    ft.app(target=main)
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/app.py", line 70, in app
    return asyncio.run(
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/app.py", line 207, in app_async
    await conn.close()
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/flet_socket_server.py", line 191, in close
    if self.__receive_loop_task:
AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'. Did you mean: '_FletSocketServer__receive_loop'?

I'm just trying to run boiler plate

import flet as ft

def main(page: ft.Page):
    

    page.add(
        
    )

if __name__ == "__main__":
    ft.app(target=main)

running in ubuntu on WSL

I had the same error, in ubuntu, I solved it doing : sudo apt-get install libmpv1

Thanks, this worked for me

@mimavox
Copy link

mimavox commented Mar 17, 2024

I'm having this problem using Flet 0.21.1

(venv) marmaduke@Urus:~/projects/My-Dev-Site$ flet run -r
/home/marmaduke/.flet/bin/flet-0.21.1/flet/flet: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/home/marmaduke/projects/My-Dev-Site/main.py", line 24, in <module>
    ft.app(target=main)
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/app.py", line 70, in app
    return asyncio.run(
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/app.py", line 207, in app_async
    await conn.close()
  File "/home/marmaduke/projects/My-Dev-Site/venv/lib/python3.10/site-packages/flet_runtime/flet_socket_server.py", line 191, in close
    if self.__receive_loop_task:
AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'. Did you mean: '_FletSocketServer__receive_loop'?

I'm just trying to run boiler plate

import flet as ft

def main(page: ft.Page):
    

    page.add(
        
    )

if __name__ == "__main__":
    ft.app(target=main)

running in ubuntu on WSL

I had the same error, in ubuntu, I solved it doing : sudo apt-get install libmpv1

Thanks, this worked for me

Con confirm that this worked for me as well.

Ubuntu 22.04 LTS (Pop!_OS - Gnome)
flet 0.21.1
flet-core 0.21.1
flet-runtime 0.21.1
python 3.12.2

@igarrio
Copy link

igarrio commented Mar 18, 2024

argeed, works in windows

nah, windows 10 also has this problem

@ndonkoHenri
Copy link
Contributor Author

This issue has already been fixed.
Install the latest pre-release and retry.

zrr1999 pushed a commit to zrr1999/flet that referenced this issue Jul 17, 2024
* Fix "_FletSocketServer__receive_loop_task" error on Linux

Fix flet-dev#2781

* Replace deprecated `datetime.utcnow()` with `datetime.now(UTC)`

Fix flet-dev#2827

* Fix a call to `self.__executor.shutdown` for Python 3.8

Fix flet-dev#2825

* Use `timezone.utc` instead of `datetime.UTC`

* Add client IP and user agent to a session ID

To make session ID hijacking harder

* Generate crypto-strong strings

* Flet version bumped to 0.21.2

* Ensure control exists in _process_remove_command

* Store session ID in SessionStorage instead of window.name

We've been storing sessionID in window.name because of flet-dev#1629.
However, `window.name` is not preserved in mobile Safari during OAuth session.

It looks like Flutter has fixed that in launchUrl() (https://github.com/flutter/packages/blob/main/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart#L87)
https://stackoverflow.com/a/73821739/1435891

* Changelog updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: linux Specific to one or more Linux distributions
Projects
None yet
Development

No branches or pull requests

8 participants