Opened 6 months ago

#23859 new defect

stem parse_file doesn't handle stdin

Reported by: teor Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

The code looks like:

from sys import stdin

from stem.descriptor import parse_file

new_micro_digests = set()

for desc in parse_file(stdin, validate = True):
    new_micro_digests.add(desc.digest)

The stack trace looks like:

$ cat 2017-10-14-17-05-00-micro | ./get_micro_fp.py
Traceback (most recent call last):
  File "./get_micro_fp.py", line 9, in <module>
    for desc in parse_file(stdin, validate = True):
  File "/Users/dev/stem/stem/descriptor/__init__.py", line 196, in parse_file
    initial_position = descriptor_file.tell()
IOError: [Errno 29] Illegal seek

Child Tickets

Change History (0)

Note: See TracTickets for help on using tickets.