SpamExperts / pyzor

Pyzor is a Python implementation of a spam-blocking networked system that use spam signatures to identify them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'

jasontibbitts opened this issue · comments

A user reported the following backtrace in https://bugzilla.redhat.com/show_bug.cgi?id=1288853
(Please ignore the fact that the reporter has no interpersonal skills whatsoever.)

Traceback (most recent call last):
File "/usr/bin/pyzor", line 408, in <module>
  main()
File "/usr/bin/pyzor", line 152, in main
  if not dispatch(client, servers, config):
File "/usr/bin/pyzor", line 239, in check
  send_digest(digested, mock_runner, servers)
File "/usr/bin/pyzor", line 262, in send_digest
  _send_digest(runner, servers[0], digested)
File "/usr/bin/pyzor", line 253, in _send_digest
  runner.run(server, (digested, server))
File "/usr/lib/python3.4/site-packages/pyzor/client.py", line 258, in run
  response = self.routine(*args, **kwargs)
File "/usr/lib/python3.4/site-packages/pyzor/client.py", line 122, in _mock_check
  pyzor.proto_version))
TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'

I'm pretty sure this is simply python3-incompatible code. What I don't yet understand is why I can't repeat it. Will have to dig into this further

A user reported the following backtrace

Thanks for bringing that up here :)

I'm pretty sure this is simply python3-incompatible code. What I don't yet understand is why I can't repeat it. Will have to dig into this further

It does seem very likely that this is a problem with Python 3. We are testing with Python 3.4.2 (https://travis-ci.org/SpamExperts/pyzor/jobs/53316283) and it should be compatible.

Would help if we could have some more information:

  • the version of Pyzor (e.g. older version are not compatible with Python 3)
  • the Python version (Pyzor should support Python 3.4)
  • how is Pyzor being installed?

Unfortunately the code needs to first run through the 2to3 tool to be compatible but pip already takes care of that if you are using:

pip install pyzor

However if you are using other methods then it needs to be converted for Python 3. We are planning to use python-future to make get rid of this step in future releases.

Somehow I didn't see your message; sorry for being slow to respond.

Fedora 23 has pyzor 1.0 and python3 3.4.3. pyzor is installed via the Fedora RPM, which I'm helping to maintain. The Fedora package doesn't apply any patches.

The RPM build process uses setup.py build (and install) to build and install things. My understanding is that this automatically ran 2to3; at least setup.py indicates that it does in the try block at the top. However, there's nothing about 2to3 in the build log so perhaps it isn't being called. I'm not entirely sure how I would check.

For what it's worth, when I saw similar issues in rps-reputation it was something reproducible in 3.4, but not in 3.5.

Assuming #58 fixes this (I verified that local bit of the code, but haven't checked if there are others).