sanctuary icon indicating copy to clipboard operation
sanctuary copied to clipboard

Package the chatroom server in an executable binary

Open gridhead opened this issue 3 years ago • 10 comments

Use PyInstaller. Make sure that the binary is compliant to Python 3.8.

gridhead avatar Sep 29 '20 18:09 gridhead

Hello, can i take on this issue?

CptOrange16 avatar Sep 29 '20 22:09 CptOrange16

What should be packaged in a single executable? The Chatroom server (servchat.py) script only or also the WebSockets Server (chatroom.py)?

CptOrange16 avatar Sep 29 '20 23:09 CptOrange16

Cool. I will assign you this issue. Be sure to get yourself registered at https://organize.mlh.io/participants/events/4659-hack-astrosonic, our official Hacktoberfest event to stay in touch with the fellow contributors of this project.

The problem statement was a bit vague so I made it precise. You need to package the chatroom server here in an executable binary.

Also, feel free to leave a star on the project - should you find it worth your time. Happy hacking! :smile:

gridhead avatar Sep 30 '20 01:09 gridhead

Hello, I am a good programmer and can package your project into executables for 2 platforms

  • Linux
  • Windows

It will take 30 minutes for me to make them shall I initiate a pull request regarding that

amaank404 avatar Sep 30 '20 07:09 amaank404

I have added a bunch of files and features for your project

amaank404 avatar Sep 30 '20 10:09 amaank404

4 issues will be solved

amaank404 avatar Sep 30 '20 10:09 amaank404

@t0xic0der I've generated a couple of binaries (windows and ubuntu) , but i can not get the server working from the executables. I always get the following error:

 jinja2.exceptions.TemplateNotFound: chatroom.html

It seems that when building the binary there is something missing along the way.

Click for full error description Traceback (most recent call last):

File "flask\app.py", line 2464, in call

File "flask\app.py", line 2450, in wsgi_app

File "flask\app.py", line 1867, in handle_exception

File "flask_compat.py", line 39, in reraise

File "flask\app.py", line 2447, in wsgi_app

File "flask\app.py", line 1952, in full_dispatch_request

File "flask\app.py", line 1821, in handle_user_exception

File "flask_compat.py", line 39, in reraise

File "flask\app.py", line 1950, in full_dispatch_request

File "flask\app.py", line 1936, in dispatch_request

File "servchat.py", line 11, in chatroom

File "flask\templating.py", line 138, in render_template

File "jinja2\environment.py", line 930, in get_or_select_template

File "jinja2\environment.py", line 883, in get_template

File "jinja2\environment.py", line 857, in _load_template

File "jinja2\loaders.py", line 115, in load

File "flask\templating.py", line 59, in get_source

File "flask\templating.py", line 81, in _get_source_explained

jinja2.exceptions.TemplateNotFound: chatroom.html

CptOrange16 avatar Oct 02 '20 00:10 CptOrange16

Hi @CptOrange16, the problem is understandable. I had the same issue when I was packaging sysmon. I have listed a potential hint here - take a look.

gridhead avatar Oct 02 '20 03:10 gridhead

Hello, I am a good programmer and can package your project into executables for 2 platforms

* Linux

* Windows

It will take 30 minutes for me to make them shall I initiate a pull request regarding that

Hi @xcodz-dot, this issue has already been assigned to @CptOrange16. You are requested to look for other issues in the organization repository.

gridhead avatar Oct 02 '20 03:10 gridhead

@t0xic0der thanks for the tip, I was missing the configurations on the servchat.py script. I generated 2 binaries: one for windows and one for linux (i used Ubuntu 18.04). They are both running and working as expected. To run use (for example):

  • On windows: binary.exe -s 6969-c 9696-4
  • On Linux: ./binary -s 6969-c 9696-4

I also left the .spec files because even though they have my system path they may be useful to see the configurations needed to generate a binary in the future.

Let me know if there is anything wrong or if you want to add anything else. Also thanks for not closing the issue, it allowed me to learn how to use pyinstaller 👍 .

CptOrange16 avatar Oct 02 '20 09:10 CptOrange16