perone / stallion

Stallion - A Python Package Manager
Other
297 stars 26 forks source link

Error when using plp show with various packages #47

Closed opritche closed 11 years ago

opritche commented 11 years ago

When I run plp show pywin32 I get the following:

pywin32 218 - Python for Window Extensions License: PSF Author: Mark Hammond (et al) Metadata-version: 1.0 Home-page: http://sourceforge.net/projects/pywin32/ Author-email: mhammond@users.sourceforge.net

Location: c:\tools\programs\python27\lib\site-packages Requires: none Traceback (most recent call last): File "C:\tools\programs\Python27\Scripts\plp-script.py", line 9, in load_entry_point('Stallion==0.4', 'console_scripts', 'plp')() File "c:\tools\programs\Python27\lib\site-packages\stallion\console.py", line 333, in run_main cmd_show(arguments) File "c:\tools\programs\Python27\lib\site-packages\stallion\console.py", line 173, in cmd_show print get_field_formatted(distinfo, 'classifier') File "c:\tools\programs\Python27\lib\site-packages\stallion\console.py", line 92, in get_field_formatted text = get_kv_colored(key, field) File "c:\tools\programs\Python27\lib\site-packages\stallion\console.py", line 57, in get_kv_colored text += Fore.WHITE + Style.NORMAL + value TypeError: cannot concatenate 'str' and 'NoneType' objects

I looked through console.py and it seems that lines 171 and 172 in the, cmd_show function, could be replaced with these three lines:

if classifier != None:
    distinfo['classifier'] = classifier
    print get_field_formatted(distinfo, 'classifier')

In line 134 classifier is set to None, followed by an If block that checks for the existence of the 'classifier' key in distinfo, if the key is not found when Python gets to line 171 it sets distinfo['classifier'] to none which causes the code to error when it calls the get_kv_colored function later.

Another possible fix that may be nicer looking would be to add the following at line 85 in the recursive_dict function: if field == None: field = "none"

This would have the output still print Classifier: with a value of none

Over all this seems to be a real handy tool, I will enjoy using it.

Thank you! Osye Pritchett

perone commented 11 years ago

Thanks for the detailed report ! Will fix it soon.

perone commented 11 years ago

Fixed !