Skip to content

Python 3 compatibility? #28

@jgerken

Description

@jgerken

According to the initial comment in wasabi_server.py Wasabi should be compatible with Python 3+. However, for me it crashes when using Python 3. I tried 3.10 locally and 3.11 down to 3.2 via the official Docker images, older versions are not available - the oldest officially supported Python 3 version is 3.7.

The first error I get is

  File "/Users/jgerken/Documents/Projects/GitHub/wasabi-orig/wasabi_server.py", line 1005
    print "Got OSError"
    ^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

After adding the missing parentheses, I get a different error (error message from Python 3.11, messages differ a bit between Python version) when accessing the server via a browser

root@d4906725a16d:/wasabi# python wasabi_server.py
/wasabi/wasabi_server.py:172: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if(useraccounts and testdir is datadir and uid is not 'skip'):
/wasabi/wasabi_server.py:175: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if(d is 'skip' or path.startswith(testdir)): return path
/wasabi/wasabi_server.py:9: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
  import cgi
03.11.22 13:33:59 - Starting server...

03.11.22 13:33:59 - Wasabi HTTP server started at port 8000

03.11.22 13:33:59 - Press CRTL+C to stop the server.

Exception in thread Thread-5 (process_request_thread):
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/wasabi/wasabi_server.py", line 1370, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/local/lib/python3.11/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python3.11/socketserver.py", line 755, in __init__
    self.handle()
  File "/usr/local/lib/python3.11/http/server.py", line 431, in handle
    self.handle_one_request()
  File "/usr/local/lib/python3.11/http/server.py", line 419, in handle_one_request
    method()
  File "/wasabi/wasabi_server.py", line 557, in do_GET
    self.wfile.write(filecontent)
  File "/usr/local/lib/python3.11/socketserver.py", line 834, in write
    self._sock.sendall(b)
TypeError: a bytes-like object is required, not 'str'

Before I try to fix this (and potentially other problems), I would like to ask to which Python 3 version is Wasabi compatible.

I used the following settings:

[server_settings]
datadir = ./data
logfile = NO
debug = NO
serverport = 8000
workerthreads = 0
cputime = 0
datalimit = 0
autoupdate = NO
useraccounts = NO
userexpire = 30
local = NO
browser = NO
linuxdesktop = NO

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions