Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

"argument of type 'int' is not iterable" in persistence #62

Closed
ad-m opened this issue May 1, 2017 · 1 comment
Closed

"argument of type 'int' is not iterable" in persistence #62

ad-m opened this issue May 1, 2017 · 1 comment
Labels

Comments

@ad-m
Copy link
Contributor

ad-m commented May 1, 2017

After a few metadata commits I received following exception

2017-04-30 21:02:44,616  INFO      Added: `Deep Purple 1970 Concerto For Group And Orchestra`
2017-04-30 21:02:46,928  INFO      Added: `Oz.the.Great.and.Powerful.2013.BRRip.XviD.BGAUDiO-SiSO`
2017-04-30 21:02:46,928  INFO      Added: `747_workout_and_jerk-out!_720p.wmv`
Traceback (most recent call last):
  File "./magneticod", line 9, in <module>
    load_entry_point('magneticod==0.3.0', 'console_scripts', 'magneticod')()
  File "/home/artur/.local/lib/python3.5/site-packages/magneticod/__main__.py", line 79, in main
    loop()
  File "/home/artur/.local/lib/python3.5/site-packages/magneticod/__main__.py", line 158, in loop
    key.fileobj.on_receivable()
  File "/home/artur/.local/lib/python3.5/site-packages/magneticod/bittorrent.py", line 140, in on_receivable
    self.__on_message(self.__incoming_buffer[4:4+length])
  File "/home/artur/.local/lib/python3.5/site-packages/magneticod/bittorrent.py", line 178, in __on_message
    self.__on_ext_message(message[2:])
  File "/home/artur/.local/lib/python3.5/site-packages/magneticod/bittorrent.py", line 264, in __on_ext_message
    self.when_metadata_found(self.__info_hash, bytes(self.__metadata))
  File "/home/artur/.local/lib/python3.5/site-packages/magneticod/__main__.py", line 113, in on_metadata_found
    succeeded = database.add_metadata(info_hash, metadata)
  File "/home/artur/.local/lib/python3.5/site-packages/magneticod/persistence.py", line 76, in add_metadata
    assert not any(b"/" in item for item in file[b"path"])
  File "/home/artur/.local/lib/python3.5/site-packages/magneticod/persistence.py", line 76, in <genexpr>
    assert not any(b"/" in item for item in file[b"path"])
TypeError: argument of type 'int' is not iterable
@boramalper
Copy link
Owner

It's line 76 of persistence.py.

I guess file[b"path"] sent by the remote peer was an integer rather than bytes / string, which we forgot to check.

It's a quick fix, I'll work on it when I have time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants