praw-dev / prawtools

A collection of tools that interact with reddit's API providing moderator utilities, subreddit statistics, and keyword alerts.
BSD 2-Clause "Simplified" License
116 stars 25 forks source link

Does not work in Windows PowerShell due to character encoding issues #27

Closed wtchen closed 9 years ago

wtchen commented 9 years ago

I don't know if this is problem with praw or subreddit_stats, but I get this error when I run it on PowerShell with Python 2.7.9:

Traceback (most recent call last):
  File "C:\Python27\Scripts\subreddit_stats-script.py", line 9, in <module>
    load_entry_point('prawtools==0.19', 'console_scripts', 'subreddit_stats')()
  File "build\bdist.win32\egg\prawtools\stats.py", line 554, in main
  File "build\bdist.win32\egg\prawtools\stats.py", line 107, in login
  File "C:\Python27\lib\site-packages\praw\decorators.py", line 88, in wrapped
    return function(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\praw\__init__.py", line 1316, in login
    pswd = getpass.getpass('Password for %s: ' % user)
  File "C:\Python27\lib\getpass.py", line 95, in win_getpass
    msvcrt.putch(c)
TypeError: must be char, not unicode

I will try to see what can be done within subreddit_stats to get it working cross-platform on Python 2.7...

bboe commented 9 years ago

Thank you for filing. It sucks that it doesn't work as-is in the powershell. I made a comment here: https://github.com/praw-dev/prawtools/pull/28#issuecomment-113348603

In general, if this is a problem, it's a problem within PRAW. However, it seems like the bug is further upstream as win_getpass should support the unicode type. Perhaps this is an opportunity to contribute to something even bigger?