blackbird icon indicating copy to clipboard operation
blackbird copied to clipboard

error in webserver

Open ManuelBot59 opened this issue 2 years ago • 10 comments

error al execute command: ´´python blackbird.py --web´´ image

ManuelBot59 avatar Jul 07 '22 19:07 ManuelBot59

Hi!

Please comment with a screenshot that shows the end of the error message.

p1ngul1n0 avatar Jul 07 '22 21:07 p1ngul1n0

image

ManuelBot59 avatar Jul 07 '22 21:07 ManuelBot59

Thanks!

The webserver is started on http://127.0.0.1:5000, the error says that this address is already in use, verify if there is any other service running in this address.

If you can't stop that other service, you will need to change the port that the webserver is started, to do that go to line 40 of webserver.py and overwrite it with this:

app.run(host='0.0.0.0', port=5001)

This should fix your problem.

p1ngul1n0 avatar Jul 08 '22 00:07 p1ngul1n0

It might be worth putting in an argument that allows users to specify a specific port so that this issue doesn't happen again. Would this be something I could work on and possibly contribute to this project?

tjhasan avatar Jul 18 '22 17:07 tjhasan

Hi Tjhasan!

Of course, any help is welcome.

p1ngul1n0 avatar Jul 19 '22 00:07 p1ngul1n0

So I've been hammering away at this for a bit and I realized that, if the --web argument is called and the command = subprocess.run() function is executed, the blackbird.py file is run a 2nd time. This sets all of the argparser args back to default.

Is there a reason why this is happening? I ask because if we can prevent it from running twice, then creating a dynamic port can just be added as an argument to argparser.

tjhasan avatar Jul 19 '22 03:07 tjhasan

The blackbird.py 2nd execution was a know bug (by me 😁) and was fixed by @Pandede in PR #25.

About the add of an argument to allow use of a specific port by the Flask WebServer, is a feature that still needs to be implemented.

p1ngul1n0 avatar Jul 21 '22 02:07 p1ngul1n0

Awesome, in that case i'll go ahead and implement that right now.

tjhasan avatar Jul 21 '22 14:07 tjhasan

Hi Manuelq059, just changed the default port to 9797, this may fix this issue for now.

p1ngul1n0 avatar Jul 25 '22 23:07 p1ngul1n0

Hi, i can't start the web-version. I get following error-message:

[!] Started WebServer on http://127.0.0.1:9797/                                                                                                                                                                
Traceback (most recent call last):                                                                                                                                                                             
  File "/home/ubuntu/Documents/blackbird/webserver.py", line 2, in <module>                                                                                                                                    
    from flask import Flask, Response, render_template, request, jsonify, send_file                                                                                                                            
  File "/home/ubuntu/Documents/env_blackbird/lib/python3.10/site-packages/flask/__init__.py", line 7, in <module>                                                                                              
    from .app import Flask as Flask                                                                                                                                                                            
  File "/home/ubuntu/Documents/env_blackbird/lib/python3.10/site-packages/flask/app.py", line 27, in <module>                                                                                                  
    from . import cli                                                                                                                                                                                          
  File "/home/ubuntu/Documents/env_blackbird/lib/python3.10/site-packages/flask/cli.py", line 17, in <module>                                                                                                  
    from .helpers import get_debug_flag                                                                                                                                                                        
  File "/home/ubuntu/Documents/env_blackbird/lib/python3.10/site-packages/flask/helpers.py", line 14, in <module>                                                                                              
    from werkzeug.urls import url_quote                                                                                                                                                                        
ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/home/ubuntu/Documents/env_blackbird/lib/python3.10/site-packages/werkzeug/urls.py)                                                          
Traceback (most recent call last):                                                                                                                                                                             
  File "/home/ubuntu/Documents/blackbird/blackbird.py", line 290, in <module>                                                                                                                                  
    command.check_returncode()                                                                                                                                                                                 
  File "/usr/lib/python3.10/subprocess.py", line 457, in check_returncode                                                                                                                                      
    raise CalledProcessError(self.returncode, self.args, self.stdout,                                                                                                                                          
subprocess.CalledProcessError: Command '('/home/ubuntu/Documents/env_blackbird/bin/python3', 'webserver.py')' returned non-zero exit status 1.   

My "Werkzeug" Version is:

pip show werkzeug                                                                                                                              
Name: Werkzeug                                     
Version: 3.0.1                                     
Summary: The comprehensive WSGI web application library.                                               
Home-page:                                         
Author:                                            
Author-email:                                      
License:                                           
Location: /home/ubuntu/Documents/env_blackbird/lib/python3.10/site-packages                        
Requires: MarkupSafe                               
Required-by: Flask 

When i downgrade "Werkzeuge" to 2.2.2 it works.

can you pleas add werkzeug==2.2.2 to the requirements.txt or make it functional with werkzeug 3.0.1?

Neconfox avatar Jan 12 '24 14:01 Neconfox