PTPAPI icon indicating copy to clipboard operation
PTPAPI copied to clipboard

Problems with piping and other stdout redirection

Open flying-sausages opened this issue 5 years ago • 2 comments

ptp search "https://passthepopcorn.me/collages.php?id=2438" order_by=addedon order_way=desc grouping=yes runs with no problem.

However, when you want to pipe it to something like for example head or tail, things get broken (e.g. ptp search "https://passthepopcorn.me/collages.php?id=2438" order_by=addedon order_way=desc grouping=yes | grep imdb

Below is a trace

ubuntu@inclusive-seriema:~$ ptp search "https://passthepopcorn.me/collages.php?id=2438" order_by=addedon order_way=desc  grouping=yes | grep imdb
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/ptp", line 11, in <module>
    load_entry_point('PTPAPI==0.5', 'console_scripts', 'ptp')()
  File "/home/ubuntu/.local/lib/python2.7/site-packages/ptpapi/scripts/ptp.py", line 341, in main
    args.func(api, args)
  File "/home/ubuntu/.local/lib/python2.7/site-packages/ptpapi/scripts/ptp.py", line 114, in do_search
    search_page(api, args, target, movies, torrents, terms.copy())
  File "/home/ubuntu/.local/lib/python2.7/site-packages/ptpapi/scripts/ptp.py", line 174, in search_page
    print(torrent_template.substitute(torrent))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 25-36: ordinal not in range(128)

flying-sausages avatar Jun 04 '20 20:06 flying-sausages

Looks like this might have something to do with me running my script within a multipass VM

flying-sausages avatar Jun 11 '20 23:06 flying-sausages

If this is still an issue, I can probably force things to decode as UTF-8, since that's all the site should ever support.

kannibalox avatar Nov 08 '21 16:11 kannibalox

Closing as stale, feel to re-open if it's still an issue.

kannibalox avatar Oct 29 '23 00:10 kannibalox