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

disabling wsgi interface fails under python3 #1377

Open
bb-migration opened this Issue Jul 19, 2015 · 22 comments

Comments

6 participants
@bb-migration

bb-migration commented Jul 19, 2015

Originally reported by: Tim Miller (Bitbucket: lashni, GitHub: Unknown)


http://docs.cherrypy.org/en/latest/advanced.html#no-need-for-the-wsgi-interface

Error is encountered when the example code from the link above is run under a python 3.4.3 virtualenv on archlinux, traceback triggers when the server is accessed. Error doesn't occur with python 2.7.10.

Happens with both current head and CherryPy 3.8.0.

[19/Jul/2015:17:41:01] ENGINE Listening for SIGUSR1.
[19/Jul/2015:17:41:01] ENGINE Listening for SIGTERM.
[19/Jul/2015:17:41:01] ENGINE Listening for SIGHUP.
[19/Jul/2015:17:41:01] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.

[19/Jul/2015:17:41:01] ENGINE Started monitor thread '_TimeoutMonitor'.
[19/Jul/2015:17:41:01] ENGINE Started monitor thread 'Autoreloader'.
[19/Jul/2015:17:41:01] ENGINE Serving on http://127.0.0.1:8080
[19/Jul/2015:17:41:01] ENGINE Bus STARTED
[19/Jul/2015:17:41:05] NATIVE_ADAPTER Traceback (most recent call last):
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/_cpnative_server.py", line 27, in respond
    sn = cherrypy.tree.script_name(req.uri or "/")
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/_cptree.py", line 257, in script_name
    path = path[:path.rfind("/")]
TypeError: 'str' does not support the buffer interface

ValueError('invalid literal for int() with base 10: "b\'5"',)
Traceback (most recent call last):
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/_cpnative_server.py", line 27, in respond
    sn = cherrypy.tree.script_name(req.uri or "/")
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/_cptree.py", line 257, in script_name
    path = path[:path.rfind("/")]
TypeError: 'str' does not support the buffer interface

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/wsgiserver/wsgiserver3.py", line 1068, in communicate
    req.respond()
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/wsgiserver/wsgiserver3.py", line 856, in respond
    self.server.gateway(self).respond()
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/_cpnative_server.py", line 88, in respond
    self.send_response(s, h, b)
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/_cpnative_server.py", line 101, in send_response
    req.send_headers()
  File "/home/lashni/dev/serve/lib/python3.4/site-packages/cherrypy/wsgiserver/wsgiserver3.py", line 912, in send_headers
    status = int(self.status[:3])
ValueError: invalid literal for int() with base 10: "b'5"

@ds6

This comment has been minimized.

ds6 commented May 27, 2016

This also occurs for me, not tested under other Python versions.
The fact that this has existed since as early as 3.8.0 up to 5.4.0 surprises me.
OS is Win7, Python 3.5.1, CherryPy 5.4.0, not behind any other proxies or load balancers.

Example server setup, based on my own:

cherrypy.config.update({'global': {
    'server.socket_host':                   '0.0.0.0',
    'server.socket_port':                   8081,

    'server.https.socket_host':             '0.0.0.0',
    'server.https.socket_port':             444,
    'server.https.ssl_module':             'builtin',
    'server.https.ssl_certificate':        'example_cert.pem',
    'server.https.ssl_private_key':        'example_key.pem',
    'server.https.ssl_certificate_chain' : 'example_chain.pem',
}})

from cherrypy._cpnative_server import CPHTTPServer
for s in (cherrypy.server, *cherrypy.servers.values()):
    s.httpserver = CPHTTPServer(s)

Trace:

>python -mexample_http_server
[26/May/2016:18:41:41] ENGINE Bus STARTING
[26/May/2016:18:41:41] ENGINE Started monitor thread 'Autoreloader'.
[26/May/2016:18:41:41] ENGINE Started monitor thread '_TimeoutMonitor'.
[26/May/2016:18:41:42] ENGINE Serving on http://0.0.0.0:8081
[26/May/2016:18:41:42] ENGINE Serving on https://0.0.0.0:444
[26/May/2016:18:41:42] ENGINE Bus STARTED

...making a request to either server...

[26/May/2016:18:41:42] NATIVE_ADAPTER Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\cherrypy\_cpnative_server.py", line 27, in respond
    sn = cherrypy.tree.script_name(req.uri or "/")
  File "C:\Python35\lib\site-packages\cherrypy\_cptree.py", line 257, in script_name
    path = path[:path.rfind("/")]
TypeError: a bytes-like object is required, not 'str'

ValueError('invalid literal for int() with base 10: "b\'5"',)
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\cherrypy\_cpnative_server.py", line 27, in respond
    sn = cherrypy.tree.script_name(req.uri or "/")
  File "C:\Python35\lib\site-packages\cherrypy\_cptree.py", line 257, in script_name
    path = path[:path.rfind("/")]
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 1091, in communicate
    req.respond()
  File "C:\Python35\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 879, in respond
    self.server.gateway(self).respond()
  File "C:\Python35\lib\site-packages\cherrypy\_cpnative_server.py", line 88, in respond
    self.send_response(s, h, b)
  File "C:\Python35\lib\site-packages\cherrypy\_cpnative_server.py", line 101, in send_response
    req.send_headers()
  File "C:\Python35\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 935, in send_headers
    status = int(self.status[:3])
ValueError: invalid literal for int() with base 10: "b'5"

...NATIVE_ADAPTER traceback repeated 5 more times...

I followed the docs to the letter, so I'm not entirely sure what the issue is.
Happens for both server instances, as well as when instantiating and accessing just one.

@jaraco jaraco added critical and removed minor labels May 27, 2016

@jaraco

This comment has been minimized.

Member

jaraco commented Dec 27, 2016

I can confirm this issue persists even after the wsgiserver refactor:

  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/_cpnative_server.py", line 27, in respond
    sn = cherrypy.tree.script_name(req.uri or '/')
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/_cptree.py", line 259, in script_name
    path = path[:path.rfind('/')]
TypeError: a bytes-like object is required, not 'str'

ValueError('invalid literal for int() with base 10: "b\'5"',)
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/_cpnative_server.py", line 27, in respond
    sn = cherrypy.tree.script_name(req.uri or '/')
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/_cptree.py", line 259, in script_name
    path = path[:path.rfind('/')]
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/wsgiserver/__init__.py", line 1408, in communicate
    req.respond()
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/wsgiserver/__init__.py", line 862, in respond
    self.server.gateway(self).respond()
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/_cpnative_server.py", line 88, in respond
    self.send_response(s, h, b)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/_cpnative_server.py", line 101, in send_response
    req.send_headers()
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/wsgiserver/__init__.py", line 923, in send_headers
    status = int(self.status[:3])
ValueError: invalid literal for int() with base 10: "b'5"
@webknjaz

This comment has been minimized.

Member

webknjaz commented Sep 29, 2017

Hmm.. What about now + cheroot?

@Kodiologist

This comment has been minimized.

Kodiologist commented May 23, 2018

Looks like this bug is still there. I just hit it with Python 3.6.5 and CherryPy 15.0.0. Using the documentation's example:

    import cherrypy

    class Root(object):
        @cherrypy.expose
        def index(self):
            return "Hello World!"

    if __name__ == '__main__':
        from cherrypy._cpnative_server import CPHTTPServer
        cherrypy.server.httpserver = CPHTTPServer(cherrypy.server)

        cherrypy.quickstart(Root(), '/')

the stack trace I get is:

    [23/May/2018:10:21:16] NATIVE_ADAPTER Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/cherrypy/_cpnative_server.py", line 30, in respond
        sn = cherrypy.tree.script_name(req.uri or '/')
      File "/usr/local/lib/python3.6/dist-packages/cherrypy/_cptree.py", line 268, in script_name
        path = path[:path.rfind('/')]
    TypeError: a bytes-like object is required, not 'str'

    ValueError('invalid literal for int() with base 10: "b\'5"',)
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/cherrypy/_cpnative_server.py", line 30, in respond
        sn = cherrypy.tree.script_name(req.uri or '/')
      File "/usr/local/lib/python3.6/dist-packages/cherrypy/_cptree.py", line 268, in script_name
        path = path[:path.rfind('/')]
    TypeError: a bytes-like object is required, not 'str'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/cheroot/server.py", line 1193, in communicate
        req.respond()
      File "/usr/local/lib/python3.6/dist-packages/cheroot/server.py", line 997, in respond
        self.server.gateway(self).respond()
      File "/usr/local/lib/python3.6/dist-packages/cherrypy/_cpnative_server.py", line 91, in respond
        self.send_response(s, h, b)
      File "/usr/local/lib/python3.6/dist-packages/cherrypy/_cpnative_server.py", line 105, in send_response
        req.send_headers()
      File "/usr/local/lib/python3.6/dist-packages/cheroot/server.py", line 1061, in send_headers
        status = int(self.status[:3])
    ValueError: invalid literal for int() with base 10: "b'5"
@webknjaz

This comment has been minimized.

Member

webknjaz commented May 23, 2018

@jaraco turns out, there's incorrect processing of bytes vs str in several places over this module.

ValueError: invalid literal for int() with base 10: "b'5"

It tried to "b'500 Internal Server Error'" get 3 digits from this thing, which looks like a repr.

TypeError: a bytes-like object is required, not 'str'

This originates in this line:

sn = cherrypy.tree.script_name(req.uri or '/')


req.uri is of type bytes as well as req.status, but something went wrong while passing those things back and forth.

@webknjaz webknjaz referenced this issue May 23, 2018

Merged

Fix native HTTP server compatibility #1712

6 of 15 tasks complete
@webknjaz

This comment has been minimized.

Member

webknjaz commented May 23, 2018

I've started fixing some things, but still need some time/help: #1712

/cc: @jaraco

jaraco added a commit that referenced this issue May 27, 2018

jaraco added a commit that referenced this issue May 28, 2018

jaraco added a commit that referenced this issue May 28, 2018

@jaraco

This comment has been minimized.

Member

jaraco commented May 28, 2018

As I'm trying to replicate the issue with that patch above, I'm running into another error (#1697):

cherrypy bugfix/1377-add-test $ tox -- test-1377.py -s
python develop-inst-nodeps: /Users/jaraco/Dropbox/code/public/cherrypy
python installed: atomicwrites==1.1.5,attrs==18.1.0,backports.functools-lru-cache==1.5,backports.unittest-mock==1.3,certifi==2018.4.16,chardet==3.0.4,cheroot==6.3.1,-e git+gh://cherrypy/cherrypy@348799ff7b23f4fcb6f165a8b4c774d81a6ca712#egg=CherryPy,codecov==2.0.15,coverage==4.5.1,graphviz==0.8.3,idna==2.6,more-itertools==4.2.0,objgraph==3.4.0,path.py==11.0.1,pluggy==0.6.0,portend==2.2,py==1.5.3,pytest==3.6.0,pytest-cov==2.5.1,pytest-sugar==0.9.1,pytz==2018.4,repoze.lru==0.7,requests==2.18.4,requests-toolbelt==0.8.0,Routes==2.4.1,six==1.11.0,tempora==1.11,termcolor==1.1.0,urllib3==1.22
python runtests: PYTHONHASHSEED='2081565896'
python runtests: commands[0] | mkdir -p /Users/jaraco/Dropbox/code/public/cherrypy/.test-results/pytest
python runtests: commands[1] | pytest test-1377.py -s
Test session starts (platform: darwin, Python 3.7.0, pytest 3.6.0, pytest-sugar 0.9.1)
cachedir: .pytest_cache
rootdir: /Users/jaraco/Dropbox/code/public/cherrypy, inifile: pytest.ini
plugins: sugar-0.9.1, cov-2.5.1, backports.unittest-mock-1.3
[28/May/2018:14:15:41] ENGINE Bus STARTING
[28/May/2018:14:15:41] ENGINE Started monitor thread 'Autoreloader'.
[28/May/2018:14:15:42] ENGINE Error in background task thread function <bound method Autoreloader.run of <cherrypy.process.plugins.Autoreloaderobject at 0x103e960f0>>.
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 518, in run
    self.function(*self.args, **self.kwargs)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 667, in run
    for filename in self.sysfiles() | self.files:
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 632, in sysfiles
    return set(filter(None, map(self._file_for_module, mods)))
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 639, in _file_for_module
    or cls._file_for_file_module(module)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 654, in _file_for_file_module
    return cls._make_absolute(module.__file__)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 661, in _make_absolute
    return filename if os.path.isabs(filename) else (
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/posixpath.py", line 66, in isabs
    s = os.fspath(s)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Exception in thread Autoreloader:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 518, in run
    self.function(*self.args, **self.kwargs)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 667, in run
    for filename in self.sysfiles() | self.files:
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 632, in sysfiles
    return set(filter(None, map(self._file_for_module, mods)))
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 639, in _file_for_module
    or cls._file_for_file_module(module)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 654, in _file_for_file_module
    return cls._make_absolute(module.__file__)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/plugins.py", line 661, in _make_absolute
    return filename if os.path.isabs(filename) else (
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/posixpath.py", line 66, in isabs
    s = os.fspath(s)
TypeError: expected str, bytes or os.PathLike object, not NoneType

[28/May/2018:14:15:46] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x103ead278>>
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/wspbus.py", line 230, in publish
    output.append(listener(*args, **kwargs))
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/_cpserver.py", line 191, in start
    super(Server, self).start()
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/servers.py", line 184, in start
    self.wait()
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/servers.py", line 260, in wait
    portend.occupied(*self.bound_addr, timeout=Timeouts.occupied)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/.tox/python/lib/python3.7/site-packages/portend.py", line 151, in occupied
    raise Timeout("Port {port} not bound on {host}.".format(**locals()))
portend.Timeout: Port 59434 not bound on 127.0.0.1.

[28/May/2018:14:15:46] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/wspbus.py", line 268, in start
    self.publish('start')
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/wspbus.py", line 248, in publish
    raise exc
cherrypy.process.wspbus.ChannelFailures: Timeout('Port 59434 not bound on 127.0.0.1.')

[28/May/2018:14:15:46] ENGINE Bus STOPPING
[28/May/2018:14:15:46] ENGINE HTTP Server cherrypy._cpnative_server.CPHTTPServer(('127.0.0.1', 8080)) already shut down
[28/May/2018:14:15:46] ENGINE Stopped thread 'Autoreloader'.
[28/May/2018:14:15:46] ENGINE Bus STOPPED
[28/May/2018:14:15:46] ENGINE Bus EXITING
[28/May/2018:14:15:46] ENGINE Bus EXITED
ERROR: InvocationError for command '/Users/jaraco/Dropbox/code/public/cherrypy/.tox/python/bin/pytest test-1377.py -s' (exited with code 70)
___________________________________________________________________ summary ____________________________________________________________________
ERROR:   python: commands failed
@webknjaz

This comment has been minimized.

Member

webknjaz commented May 28, 2018

@jaraco yes, exactly. that's why it's WIP

@webknjaz

This comment has been minimized.

Member

webknjaz commented May 28, 2018

You could try Python 3.6 for now

jaraco added a commit that referenced this issue May 28, 2018

@jaraco

This comment has been minimized.

Member

jaraco commented May 28, 2018

I've fixed #1697 and now I'm getting the same result on my test branch on Python 3.7 and 3.6:

cherrypy bugfix/1377-add-test $ tox -e py36 -- test-1377.py -s
py36 create: /Users/jaraco/Dropbox/code/public/cherrypy/.tox/py36
py36 develop-inst: /Users/jaraco/Dropbox/code/public/cherrypy
py36 installed: You are using pip version 9.0.1, however version 10.0.1 is available.,You should consider upgrading via the 'pip install --upgrade pip' command.,atomicwrites==1.1.5,attrs==18.1.0,backports.functools-lru-cache==1.5,backports.unittest-mock==1.3,certifi==2018.4.16,chardet==3.0.4,cheroot==6.3.1,-e git+gh://cherrypy/cherrypy@86ce228bdb55b4d74b55e70154d4816cdc355a53#egg=CherryPy,codecov==2.0.15,coverage==4.5.1,graphviz==0.8.3,idna==2.6,more-itertools==4.2.0,objgraph==3.4.0,path.py==11.0.1,pluggy==0.6.0,portend==2.2,py==1.5.3,pytest==3.6.0,pytest-cov==2.5.1,pytest-sugar==0.9.1,pytz==2018.4,repoze.lru==0.7,requests==2.18.4,requests-toolbelt==0.8.0,Routes==2.4.1,six==1.11.0,tempora==1.11,termcolor==1.1.0,urllib3==1.22
py36 runtests: PYTHONHASHSEED='3159197583'
py36 runtests: commands[0] | mkdir -p /Users/jaraco/Dropbox/code/public/cherrypy/.test-results/pytest
py36 runtests: commands[1] | pytest test-1377.py -s
Test session starts (platform: darwin, Python 3.6.4, pytest 3.6.0, pytest-sugar 0.9.1)
cachedir: .pytest_cache
rootdir: /Users/jaraco/Dropbox/code/public/cherrypy, inifile: pytest.ini
plugins: sugar-0.9.1, cov-2.5.1, backports.unittest-mock-1.3
[28/May/2018:14:35:57] ENGINE Bus STARTING
[28/May/2018:14:35:57] ENGINE Started monitor thread 'Autoreloader'.
[28/May/2018:14:36:03] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x10d821630>>
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/wspbus.py", line 230, in publish
    output.append(listener(*args, **kwargs))
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/_cpserver.py", line 191, in start
    super(Server, self).start()
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/servers.py", line 184, in start
    self.wait()
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/servers.py", line 260, in wait
    portend.occupied(*self.bound_addr, timeout=Timeouts.occupied)
  File "/Users/jaraco/Dropbox/code/public/cherrypy/.tox/py36/lib/python3.6/site-packages/portend.py", line 151, in occupied
    raise Timeout("Port {port} not bound on {host}.".format(**locals()))
portend.Timeout: Port 59851 not bound on 127.0.0.1.

[28/May/2018:14:36:03] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/wspbus.py", line 268, in start
    self.publish('start')
  File "/Users/jaraco/Dropbox/code/public/cherrypy/cherrypy/process/wspbus.py", line 248, in publish
    raise exc
cherrypy.process.wspbus.ChannelFailures: Timeout('Port 59851 not bound on 127.0.0.1.',)

[28/May/2018:14:36:03] ENGINE Bus STOPPING
[28/May/2018:14:36:03] ENGINE HTTP Server cherrypy._cpnative_server.CPHTTPServer(('127.0.0.1', 8080)) already shut down
[28/May/2018:14:36:03] ENGINE Stopped thread 'Autoreloader'.
[28/May/2018:14:36:03] ENGINE Bus STOPPED
[28/May/2018:14:36:03] ENGINE Bus EXITING
[28/May/2018:14:36:03] ENGINE Bus EXITED
ERROR: InvocationError for command '/Users/jaraco/Dropbox/code/public/cherrypy/.tox/py36/bin/pytest test-1377.py -s' (exited with code 70)
___________________________________________________________________ summary ____________________________________________________________________
ERROR:   py36: commands failed

I'm still unsuccessful in setting up a native HTTP server. Any idea what I'm doing wrong in attempting to replicate the reported issue?

@webknjaz

This comment has been minimized.

Member

webknjaz commented May 28, 2018

@jaraco try not changing port and sticking to default. I experienced some issues (I didn't find out why) when trying to change port, but it worked (replicated) with default port setting.

jaraco added a commit that referenced this issue May 29, 2018

@jaraco

This comment has been minimized.

Member

jaraco commented May 29, 2018

Indeed. That seems like another bug (or limitation, maybe). Working with the default port, the test now replicates the reported failure. Thanks for the tip.

jaraco added a commit that referenced this issue May 29, 2018

jaraco added a commit that referenced this issue May 30, 2018

jaraco added a commit that referenced this issue May 31, 2018

@webknjaz

This comment has been minimized.

Member

webknjaz commented Aug 15, 2018

@jaraco this is still open, but changelog for v16.0.0 mentions some change related to it. Could you please verify this?

@jaraco

This comment has been minimized.

Member

jaraco commented Aug 15, 2018

It was fixed in #1712.

@jaraco jaraco closed this Aug 15, 2018

jaraco added a commit that referenced this issue Aug 15, 2018

@carlodri

This comment has been minimized.

carlodri commented Sep 20, 2018

I'm still experiencing the same issue with the example in the docs (Python 3.6.6 + Cherrypy 18.0.1 + cheroot 6.4.0 on Win10x64):

(pythr02-env) λ python webservice.py
[20/Sep/2018:15:34:52] ENGINE Listening for SIGTERM.
[20/Sep/2018:15:34:52] ENGINE Bus STARTING
[20/Sep/2018:15:34:52] ENGINE Set handler for console events.
CherryPy Checker:
The Application mounted at '' has an empty config.

[20/Sep/2018:15:34:52] ENGINE Started monitor thread 'Autoreloader'.
[20/Sep/2018:15:34:52] ENGINE Serving on http://127.0.0.1:8080
[20/Sep/2018:15:34:52] ENGINE Bus STARTED
[20/Sep/2018:15:34:56] NATIVE_ADAPTER Traceback (most recent call last):
  File "C:\Miniconda3x64\envs\pythr02-env\lib\site-packages\cherrypy\_cpnative_server.py", line 30, in respond
    sn = cherrypy.tree.script_name(req.uri or '/')
  File "C:\Miniconda3x64\envs\pythr02-env\lib\site-packages\cherrypy\_cptree.py", line 281, in script_name
    path = path[:path.rfind('/')]
TypeError: a bytes-like object is required, not 'str'

[20/Sep/2018:15:34:56] NATIVE_ADAPTER Traceback (most recent call last):
  File "C:\Miniconda3x64\envs\pythr02-env\lib\site-packages\cherrypy\_cpnative_server.py", line 30, in respond
    sn = cherrypy.tree.script_name(req.uri or '/')
  File "C:\Miniconda3x64\envs\pythr02-env\lib\site-packages\cherrypy\_cptree.py", line 281, in script_name
    path = path[:path.rfind('/')]
TypeError: a bytes-like object is required, not 'str'
@webknjaz

This comment has been minimized.

Member

webknjaz commented Sep 20, 2018

@carlodri and what is the version of Cheroot?

@webknjaz webknjaz reopened this Sep 20, 2018

@webknjaz

This comment has been minimized.

Member

webknjaz commented Sep 20, 2018

Oh, Cheroot is probably irrelevant..

But some STR would be useful.

@webknjaz

This comment has been minimized.

Member

webknjaz commented Sep 20, 2018

@webknjaz

This comment has been minimized.

Member

webknjaz commented Sep 20, 2018

6cc67e0

@jaraco do you remember anything wrt this?

@jaraco

This comment has been minimized.

Member

jaraco commented Sep 25, 2018

If I recall correctly, the tests were using Unix sockets, so the tests couldn’t run on Windows. Still, some things were fixed. Probably better to open a new issue at this point for ongoing issues. Link to this one for reference.

@webknjaz

This comment has been minimized.

Member

webknjaz commented Oct 17, 2018

@jaraco, no, those unix socket tests are in cheroot

@jaraco

This comment has been minimized.

Member

jaraco commented Oct 17, 2018

hmm. Okay. Reviewing that change, it does seem that I disabled the test without a good reason (other than it was failing and I wanted to get the fix out that was passing on Unix). We should revisit and investigate why it's failing on Windows only and get that fixed too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment