ncrocfer / whatportis

Whatportis : explore IANA's list of ports

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The solution for can not find any port

theLSA opened this issue · comments

commented

Hi,this project is nice!

But when I install it by "pip install whatportis" or setup,I can't get any port(such as No ports found for 'redis').Then I try "whatportis --update",I got the error "UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 46: ordinal not in range(128)",and I found that "whatportis_db.json" is 0kb,so it seems that is encoding error(Maybe service-names-port-numbers.csv have some special characters).

Solution:
In "whatportis-script.py" add three lines:


#encoding=utf-8   //add utf-8
#!c:\python27\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'whatportis==0.7','console_scripts','whatportis'
__requires__ = 'whatportis==0.7'
import re
import sys
from pkg_resources import load_entry_point
reload(sys)   //add
sys.setdefaultencoding('utf8')   //add

After that,It worked!
(Both win7 and debian have this problem)

Hi,

Indeed there was a bug in whatportis when handling unicode in Py2 :-/ It's now fix in 0.8 version, you can pip install whatportis --upgrade to make it work.

Thank you for your report !