Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59840
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <vietht2@viettel.com.vn> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'skip:[ 20': 0.04; 'yet.': 0.04; 'error:': 0.07; "subject:' ": 0.07; 'username,': 0.07; 'host,': 0.09; 'idea?': 0.09; 'line:': 0.09; 'subject:position': 0.09; 'python': 0.11; 'def': 0.12; 'windows': 0.15; 'bit.': 0.16; 'codec': 0.16; 'debugged': 0.16; 'eclipse': 0.16; 'ordinal': 0.16; 'skip:[ 40': 0.16; 'subject: \n ': 0.16; 'timeout': 0.16; 'timeout)': 0.16; 'all,': 0.19; 'import': 0.22; 'byte': 0.24; 'skip:{ 20': 0.24; 'options': 0.25; 'code:': 0.26; "skip:' 10": 0.31; 'file:': 0.31; 'os,': 0.31; 'skip:c 30': 0.32; 'run': 0.32; "can't": 0.35; 'connection': 0.35; 'but': 0.35; 'url:rec-html40': 0.35; 'url:org': 0.36; 'url:microsoft': 0.37; 'url:office': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'url:schemas': 0.38; 'url:omml': 0.39; 'url:2004': 0.39; 'skip:& 20': 0.39; 'subject:can': 0.39; 'url:12': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'skip:u 10': 0.60; 'skip:t 30': 0.61; 'from:charset:utf-8': 0.61; 'skip:\xe2 10': 0.65; 'here': 0.66; '8bit%:74': 0.68; '8bit%:96': 0.70; 'internet': 0.71; 'export': 0.74; 'received:203': 0.74; '8bit%:16': 0.84; 'received:220.231': 0.84; '8bit%:58': 0.91; '8bit%:70': 0.91; '8bit%:55': 0.93 |
| Date | Mon, 18 Nov 2013 11:55:39 +0700 |
| From | Hoàng Tuấn Việt <vietht2@viettel.com.vn> |
| Subject | UnicodeDecodeError: 'ascii' codec can't decodee byte 0xff in position 0: ordinal not in range(128) |
| Sender | vietht2@viettel.com.vn |
| To | python-list@python.org |
| MIME-version | 1.0 |
| X-Mailer | Microsoft Outlook 14.0 |
| Content-type | multipart/alternative; boundary="Boundary_(ID_E/4IbDwDEnubOe6Ijgqz/A)" |
| Content-language | en-us |
| Thread-index | Ac7kGOU/AnVipb6bTz6AgyazK2Iu2g== |
| X-Mailman-Approved-At | Mon, 18 Nov 2013 09:27:19 +0100 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2825.1384763240.18130.python-list@python.org> (permalink) |
| Lines | 346 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1384763240 news.xs4all.nl 15964 [2001:888:2000:d::a6]:38736 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:59840 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi all,
I use Python telnetlib on Windows 7 32 bit. Here is my code:
def telnet(self, host, os, username, password):
connection = telnetlib.Telnet(host)
connection.read_until('login: ')
connection.write(username + '\r')
connection.read_until('assword: ')
connection.write(password + '\r')
connection.read_until('>', timeout = TIMEOUT)
return connection
I can run the program in Eclipse and telnet successfully to a Windows host.
But when I export to .exe file:
from distutils.core import setup
import py2exe
setup(
options = {
"py2exe":{
"packages": ['wx.lib.pubsub'],
"dll_excludes": ["MSVCP90.dll", "HID.DLL", "w9xpopen.exe"],
}
},
console = [{'script': ‘my_program.py'}]
)
and run the programe, I encounter this error:
UnicodeDecodeError: 'ascii' codec can't decodee byte 0xff in position 0: ordinal not in range(128)
at line:
connection.write(username + '\r')
I have debugged and searched the Internet hard but found no solution yet.
I think it is because of ‘\r’.
Do you have any idea?
Viet
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
UnicodeDecodeError: 'ascii' codec can't decodee byte 0xff in position 0: ordinal not in range(128) Hoàng Tuấn Việt <vietht2@viettel.com.vn> - 2013-11-18 11:55 +0700 Re: UnicodeDecodeError: 'ascii' codec can't decodee byte 0xff in position 0: ordinal not in range(128) "Colin J. Williams" <cjw@ncf.ca> - 2013-11-18 08:16 -0500
csiph-web