starpy icon indicating copy to clipboard operation
starpy copied to clipboard

TypeError on Python3.6.x in FastAGI.

Open vitimm144 opened this issue 6 years ago • 3 comments

Hi,

When I have run the FastAGI script with python 3.6.8, I have gotten the following error:

image

I think, I found a solution to fix it. How can i contribute to fix the error?

vitimm144 avatar Jun 13 '19 19:06 vitimm144

You may contribute a patch using github pull requests.

For more info, see: https://help.github.com/en/articles/about-pull-requests

russellb avatar Jun 14 '19 12:06 russellb

Looking at the error, a workaround may be to use Python 2.

russellb avatar Jun 14 '19 12:06 russellb

First of all, copying and pasting the actual text would be better than a screenshot.

Secondly, the error seems to be entirely within twisted modules, not starpy itself.

Thirdly, I don’t see how that error can occur with current twisted. A little above the source line where the error is reported:

lines = (self._buffer + data).split(self.delimiter)

I see that delimiter is initialized thus:

delimiter = b"\r\n"

Which looks fine (at least with twisted 22.4 on my Debian system). Unless some outside code is inappropriately changing this value via something like

LineOnlyReceiver.delimiter = "\r\n"

which could cause the error observed ...

... ah, I see, yes. In starpy/fastagi.py, for example, we have class FastAGIProtocol, which subclasses twisted’s LineOnlyReceiver, and overrides the above class variable definition with this line:

delimiter = '\n'

That would certainly cause trouble like that observed.

ldo avatar Nov 10 '22 23:11 ldo