Liam Marsh
2014-07-01 16:31:22 UTC
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.*
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.*