[Python-ideas] error in os.popen result
Steven D'Aprano
steve at pearwood.info
Tue Jul 1 19:04:22 CEST 2014
Hello Liam,
This is a mailing list for discussing possible future ideas for the next
version of Python, not for general support.
I recommend that you use the python-list at python.org mailing list, also
available via Usenet on comp.lang.python.
Good luck.
On Tue, Jul 01, 2014 at 06:31:22PM +0200, Liam Marsh wrote:
> hello, for a small server program, I wanted to know which ports were
> occuped.
> with the dos command 'netstat'
> so I tried this:
>
> *>>>a=os.popen('netstat')*
> *>>>bytes(a.read())*
>
> but this occured in the second step:
>
> *Traceback (most recent call last):*
> * File "<pyshell#20>", line 1, in <module>*
> * bytes(a.read())*
> * File "C:\Apps\Programmation\Python3.2\lib\encodings\cp1252.py", line 23,
> in decode*
> * return codecs.charmap_decode(input,self.errors,decoding_table)[0]*
> *UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 79:
> character maps to <undefined>*
>
> *how can I avoid it and why does the windows cmd does return an
> undecodable character?*
>
> *thank you.*
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
More information about the Python-ideas
mailing list