From stewart.midwinter at gmail.com Thu Mar 10 00:43:11 2005 From: stewart.midwinter at gmail.com (Stewart Midwinter) Date: Thu Mar 10 00:43:13 2005 Subject: [PythonCE] alternative to os.popen in PythonCE? Message-ID: I've got an application on my desktop that I'm tryiing to port to PythonCE - it's a version of rsync. I need to run os.popen(), but it's not available in PythonCE. What are you using to run system commands and capture output from those commands? Do I have any alternatives? cheers, -- Stewart Midwinter stewart@midwinter.ca stewart.midwinter@gmail.com From mike at pcblokes.com Thu Mar 10 09:59:42 2005 From: mike at pcblokes.com (mike@pcblokes.com) Date: Thu Mar 10 10:00:09 2005 Subject: [PythonCE] alternative to os.popen in PythonCE? In-Reply-To: References: Message-ID: <1110445204.42300c94caa40@www.pcblokes.com> Quoting Stewart Midwinter : > I've got an application on my desktop that I'm tryiing to port to > PythonCE - it's a version of rsync. I need to run os.popen(), but > it's not available in PythonCE. > There is a version of 'osce.py' that provides the functions you need. It was created by 'telion' and was mentioned on the list not long ago. Either gogole or the list archives will find it. As python has 'OS specific' versions of several modules already, there would be a case for moiving this into core python (IMHO). Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml > What are you using to run system commands and capture output from > those commands? Do I have any alternatives? > > cheers, > -- > Stewart Midwinter > stewart@midwinter.ca > stewart.midwinter@gmail.com > _______________________________________________ > PythonCE mailing list > PythonCE@python.org > http://mail.python.org/mailman/listinfo/pythonce > From widomski at elproma.com.pl Fri Mar 11 13:06:10 2005 From: widomski at elproma.com.pl (Tomasz Widomski) Date: Fri Mar 11 13:06:16 2005 Subject: [PythonCE] I am looking for Python implementation for iPAQ h2210 ( running Windows CE v4.20 on Intel PXA255). Where can I found it ? Message-ID: I am looking for Python implementation for iPAQ h2210 ( running Windows CE v4.20 on Intel PXA255) Please advice if there is one available ? Regards, Tomasz Widomski From jdavis at wgen.net Fri Mar 11 16:08:22 2005 From: jdavis at wgen.net (Jesse Davis) Date: Fri Mar 11 16:08:28 2005 Subject: [PythonCE] I am looking for Python implementation for iPAQ h2210 (running Windows CE v4.20 on Intel PXA255). Where can I found it ? Message-ID: Hi Tomasz, There are binaries & source for Python 2.3 at http://fore.validus.com/~kashtan/ The binaries worked for me without pain. Just decompress the zip file & copy the directories onto the handheld using Explorer: the stuff in "Windows" goes into "\Windows" on the handheld, etc. I recommend the pysvr.py that's been posted to this list before -- it allows you to telnet into the handheld, so you can use the desktop's keyboard. =) This is what I've done to build from source: If you haven't already, download from microsoft.com eMbedded Visual C++ 4.0 and the Pocket PC 2003 SDK (assuming that's your platform). Get the Python-2.3.5 source from SourceForge or python.org. Once you've unzipped the directory tree, get http://fore.validus.com/~kashtan/Python-2.3.4-WinCE-Sources.zip & copy it over your tree. Enter the directory wherever\Python-2.3.5\PCbuild\WinCE Run PCBuild\WinCE\WCEARM.bat to set up your environment. You must also set the environment variables SDKROOT (wherever you installed the SDK), PYTHONROOT (wherever you installed Python 2.3.x on your machine), INCLUDE (various arch-specific directories under "Windows CE Tools"), PATH (add "wherever\Microsoft eMbedded C++ 4.0\EVC\WCE400\BIN"), and LIB (more arch-specific directories under "Windows CE Tools"). Now, say "nmake". If the compiler complains about missing files, find them in the SDK or Windows CE Tools directories & add those directories to INCLUDE or LIB. To build the win32 extensions, get them from SourceForge, set PYWIN32ROOT to the source directory, & say "nmake all" (still from the Python-2.3.5\PCbuild\WinCE directory). (I'm just a noob copying my notes, wiser heads are encouraged to correct me.) Good luck-- Jesse P.S. Besides running WCEARM.bat, here's my environment: set PYWIN32ROOT=C:\share\pywin32 set SDKROOT=C:\Program Files\Windows CE Tools set PYTHONROOT=C:\Python23 set INCLUDE=C:\Program Files\Windows CE Tools\WCE420\pocket pc 2003\include\armv4;C:\Program Files\Windows CE Tools\WCE420\pocket pc 2003\MFC\include;C:\Program Files\Windows CE Tools\WCE420\pocket pc 2003\ATL\include; set PATH=%PATH%;c:\Program Files\Microsoft eMbedded C++ 4.0\EVC\WCE400\BIN set LIB=C:\Program Files\Windows CE Tools\WCE420\pocket pc 2003\lib\armv4;C:\Program Files\Windows CE Tools\WCE420\pocket pc 2003\MFC\lib\armv4;C:\Program Files\Windows CE Tools\WCE420\pocket pc 2003\ATL\lib\armv4 -----Original Message----- From: pythonce-bounces@python.org [mailto:pythonce-bounces@python.org] On Behalf Of Tomasz Widomski Sent: Friday, March 11, 2005 7:06 AM To: pythonce@python.org Subject: [PythonCE] I am looking for Python implementation for iPAQ h2210 (running Windows CE v4.20 on Intel PXA255). Where can I found it ? I am looking for Python implementation for iPAQ h2210 ( running Windows CE v4.20 on Intel PXA255) Please advice if there is one available ? Regards, Tomasz Widomski _______________________________________________ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce From isrgish at fastem.com Fri Mar 11 17:02:18 2005 From: isrgish at fastem.com (Isr Gish) Date: Fri Mar 11 17:01:49 2005 Subject: [PythonCE] alternative to os.popen in PythonCE? Message-ID: <20050311160147.BC3951E4006@bag.python.org> Here's a copy Isr -----Original Message----- >From: "mike@pcblokes.com" >Sent: 3/10/05 3:59:42 AM >To: "Stewart Midwinter" >Cc: "pythonce@python.org" >Subject: Re: [PythonCE] alternative to os.popen in PythonCE? > >Quoting Stewart Midwinter : > >> I've got an application on my desktop that I'm tryiing to port to >> PythonCE - it's a version of rsync. I need to run os.popen(), but >> it's not available in PythonCE. >> > >There is a version of 'osce.py' that provides the functions you need. It was >created by 'telion' and was mentioned on the list not long ago. Either gogole >or the list archives will find it. > >As python has 'OS specific' versions of several modules already, there would be >a case for moiving this into core python (IMHO). > >Regards, > >Fuzzy >http://www.voidspace.org.uk/python/index.shtml > >> What are you using to run system commands and capture output from >> those commands? Do I have any alternatives? >> >> cheers, >> -- >> Stewart Midwinter >> stewart@midwinter.ca >> stewart.midwinter@gmail.com >> _______________________________________________ >> PythonCE mailing list >> PythonCE@python.org >> http://mail.python.org/mailman/listinfo/pythonce >> > > > >_______________________________________________ >PythonCE mailing list >PythonCE@python.org >http://mail.python.org/mailman/listinfo/pythonce -------------- next part -------------- A non-text attachment was scrubbed... Name: osce.py Type: application/octet-stream Size: 3065 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonce/attachments/20050311/7bca1cdf/osce.obj From mike at pcblokes.com Mon Mar 14 13:03:30 2005 From: mike at pcblokes.com (Michael Foord) Date: Mon Mar 14 13:04:18 2005 Subject: [PythonCE] UnicodeDecodeError with print Message-ID: <42357D92.7070305@pcblokes.com> I am wondering if anyone knows the reason as to why : print u'?' should cause a UnicodeDecodeError on pythonce ? (The usual 'ascii codec cannot decode character...' message). Obviously the '?' character is a non-ascii character. I am just surprised that the print statement is using the ascii encoding at all and not just passing the string to sys.stdout. The particular reason I ask is that this doesn't happen with 'normal' python... but I would like to know how the print statement decodes unicode strings it prints. Since it *doesn't* raise an error normally it obviously doesn't use defaultencoding - so why does the pyhonce one ? Yours curiously, Fuzzyman http://www.voidspace.org.uk/python/index.shtml From anne.wangnick at t-online.de Mon Mar 14 19:06:50 2005 From: anne.wangnick at t-online.de (anne.wangnick@t-online.de) Date: Mon Mar 14 19:07:15 2005 Subject: AW: [PythonCE] UnicodeDecodeError with print In-Reply-To: <42357D92.7070305@pcblokes.com> Message-ID: Hello Michael, this can happen with "normal" Python as well, try this running python.exe directly. The issue is not that you create a unicode object, the issue is that you want to print it. On the PC when using IDLE, sys.stdout.encoding is set to "cp1252". For file objects, "when Unicode strings are written to a file, they will be converted to byte strings using this encoding". On the PDA, however, sys.stdout is a built-in module _pcceshell_support. Seemingly this module tries to convert unicode objects into strings using the "ascii" encoding, and this stumbles on the pound sign. Thus, on the PDA, you have to take care of the conversion of unicode objects to strings yourself before calling print. For instance: u = u'?' print u.encode("cp1252") Now this doesn't fail, but it doesn't print a pound sign as well. But at least it seems to do the same as if you had written: print '?' [It gets more interesting when the string '?' is contained in a source file. Try to put the following into a file using IDLE on the PC, and run it: # -*- coding: utf-8 -*- print "?".encode("hex") You'll get c2a3. This is because IDLE itself sees the first line of your file, and encodes the pound sign as c2a3 when storing the file. Or try in a file: # -*- coding: utf-8 -*- print [hex(ord(c)) for c in u"?"] This time, IDLE stored the pound sign as c2a3 again, but Python also uses the magic first line when building the unicode object to convert c2a3 to a unicode character. When you use Pocket Word, or so, to create a Python source file, it will of course not understand your magic first line and bluntly store the pound sign as a3. Thus, all of your string literals are actually cp1252-encoded.] Regards, Sebastian -----Urspr?ngliche Nachricht----- Von: pythonce-bounces@python.org [mailto:pythonce-bounces@python.org]Im Auftrag von Michael Foord Gesendet: Montag, 14. M?rz 2005 13:04 An: pythonce@python.org Betreff: [PythonCE] UnicodeDecodeError with print I am wondering if anyone knows the reason as to why : print u'?' should cause a UnicodeDecodeError on pythonce ? (The usual 'ascii codec cannot decode character...' message). Obviously the '?' character is a non-ascii character. I am just surprised that the print statement is using the ascii encoding at all and not just passing the string to sys.stdout. The particular reason I ask is that this doesn't happen with 'normal' python... but I would like to know how the print statement decodes unicode strings it prints. Since it *doesn't* raise an error normally it obviously doesn't use defaultencoding - so why does the pyhonce one ? Yours curiously, Fuzzyman http://www.voidspace.org.uk/python/index.shtml _______________________________________________ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce From isrgish at fastem.com Tue Mar 15 01:03:59 2005 From: isrgish at fastem.com (Isr Gish) Date: Tue Mar 15 01:07:37 2005 Subject: AW: [PythonCE] UnicodeDecodeError with print Message-ID: <20050315000735.C110C1E4002@bag.python.org> You can set the default encoding in site.py with sys.setdefaultencoding(...) function. Make sure to do it before it is deleted. For it this function is deleted somewhere in the site module. All the best, Isr -----Original Message----- >From: "anne.wangnick@t-online.de" >Sent: 3/14/05 1:06:50 PM >To: "Michael Foord", "pythonce@python.org" >Subject: AW: [PythonCE] UnicodeDecodeError with print > >Hello Michael, > >this can happen with "normal" Python as well, try this running python.exe >directly. >The issue is not that you create a unicode object, the issue is that you >want to print it. On the PC when using IDLE, sys.stdout.encoding is set to >"cp1252". For file objects, "when Unicode strings are written to a file, >they will be converted to byte strings using this encoding". > >On the PDA, however, sys.stdout is a built-in module _pcceshell_support. >Seemingly this module tries to convert unicode objects into strings using >the "ascii" encoding, and this stumbles on the pound sign. > >Thus, on the PDA, you have to take care of the conversion of unicode objects >to strings yourself before calling print. For instance: > u = u'?' > print u.encode("cp1252") > >Now this doesn't fail, but it doesn't print a pound sign as well. But at >least it seems to do the same as if you had written: > print '?' > >[It gets more interesting when the string '?' is contained in a source file. >Try to put the following into a file using IDLE on the PC, and run it: > # -*- coding: utf-8 -*- > print "?".encode("hex") >You'll get c2a3. This is because IDLE itself sees the first line of your >file, and encodes the pound sign as c2a3 when storing the file. > >Or try in a file: > # -*- coding: utf-8 -*- > print [hex(ord(c)) for c in u"?"] >This time, IDLE stored the pound sign as c2a3 again, but Python also uses >the magic first line when building the unicode object to convert c2a3 to a >unicode character. > >When you use Pocket Word, or so, to create a Python source file, it will of >course not understand your magic first line and bluntly store the pound sign >as a3. Thus, all of your string literals are actually cp1252-encoded.] > >Regards, >Sebastian > >-----Urspr?ngliche Nachricht----- >Von: pythonce-bounces@python.org [mailto:pythonce-bounces@python.org]Im >Auftrag von Michael Foord >Gesendet: Montag, 14. M?rz 2005 13:04 >An: pythonce@python.org >Betreff: [PythonCE] UnicodeDecodeError with print > > >I am wondering if anyone knows the reason as to why : > >print u'?' > >should cause a UnicodeDecodeError on pythonce ? (The usual 'ascii codec >cannot decode character...' message). > >Obviously the '?' character is a non-ascii character. I am just >surprised that the print statement is using the ascii encoding at all >and not just passing the string to sys.stdout. > >The particular reason I ask is that this doesn't happen with 'normal' >python... but I would like to know how the print statement decodes >unicode strings it prints. Since it *doesn't* raise an error normally it >obviously doesn't use defaultencoding - so why does the pyhonce one ? > >Yours curiously, > >Fuzzyman >http://www.voidspace.org.uk/python/index.shtml >_______________________________________________ >PythonCE mailing list >PythonCE@python.org >http://mail.python.org/mailman/listinfo/pythonce > >_______________________________________________ >PythonCE mailing list >PythonCE@python.org >http://mail.python.org/mailman/listinfo/pythonce From mike at pcblokes.com Tue Mar 15 09:29:52 2005 From: mike at pcblokes.com (Michael Foord) Date: Tue Mar 15 09:29:57 2005 Subject: AW: [PythonCE] UnicodeDecodeError with print Message-ID: <42369D00.6000205@pcblokes.com> Isr Gish wrote: >You can set the default encoding in site.py with sys.setdefaultencoding(...) function. Make sure to do it before it is deleted. For it this function is deleted somewhere in the site module. > > > The encoding that I need is ``sys.stdout.encoding`` not ``sys.defaultencoding`` (as I learned yesterday). Thanks for the reply though... Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml >All the best, >Isr > >-----Original Message----- > >From: "anne.wangnick@t-online.de" > >Sent: 3/14/05 1:06:50 PM > >To: "Michael Foord", "pythonce@python.org" > >Subject: AW: [PythonCE] UnicodeDecodeError with print > > > >Hello Michael, > > > >this can happen with "normal" Python as well, try this running python.exe > >directly. > >The issue is not that you create a unicode object, the issue is that you > >want to print it. On the PC when using IDLE, sys.stdout.encoding is set to > >"cp1252". For file objects, "when Unicode strings are written to a file, > >they will be converted to byte strings using this encoding". > > > >On the PDA, however, sys.stdout is a built-in module _pcceshell_support. > >Seemingly this module tries to convert unicode objects into strings using > >the "ascii" encoding, and this stumbles on the pound sign. > > > >Thus, on the PDA, you have to take care of the conversion of unicode objects > >to strings yourself before calling print. For instance: > > u = u'?' > > print u.encode("cp1252") > > > >Now this doesn't fail, but it doesn't print a pound sign as well. But at > >least it seems to do the same as if you had written: > > print '?' > > > >[It gets more interesting when the string '?' is contained in a source file. > >Try to put the following into a file using IDLE on the PC, and run it: > > # -*- coding: utf-8 -*- > > print "?".encode("hex") > >You'll get c2a3. This is because IDLE itself sees the first line of your > >file, and encodes the pound sign as c2a3 when storing the file. > > > >Or try in a file: > > # -*- coding: utf-8 -*- > > print [hex(ord(c)) for c in u"?"] > >This time, IDLE stored the pound sign as c2a3 again, but Python also uses > >the magic first line when building the unicode object to convert c2a3 to a > >unicode character. > > > >When you use Pocket Word, or so, to create a Python source file, it will of > >course not understand your magic first line and bluntly store the pound sign > >as a3. Thus, all of your string literals are actually cp1252-encoded.] > > > >Regards, > >Sebastian > > > >-----Urspr?ngliche Nachricht----- > >Von: pythonce-bounces@python.org [mailto:pythonce-bounces@python.org]Im > >Auftrag von Michael Foord > >Gesendet: Montag, 14. M?rz 2005 13:04 > >An: pythonce@python.org > >Betreff: [PythonCE] UnicodeDecodeError with print > > > > > >I am wondering if anyone knows the reason as to why : > > > >print u'?' > > > >should cause a UnicodeDecodeError on pythonce ? (The usual 'ascii codec > >cannot decode character...' message). > > > >Obviously the '?' character is a non-ascii character. I am just > >surprised that the print statement is using the ascii encoding at all > >and not just passing the string to sys.stdout. > > > >The particular reason I ask is that this doesn't happen with 'normal' > >python... but I would like to know how the print statement decodes > >unicode strings it prints. Since it *doesn't* raise an error normally it > >obviously doesn't use defaultencoding - so why does the pyhonce one ? > > > >Yours curiously, > > > >Fuzzyman > >http://www.voidspace.org.uk/python/index.shtml > >_______________________________________________ > >PythonCE mailing list > >PythonCE@python.org > >http://mail.python.org/mailman/listinfo/pythonce > > > >_______________________________________________ > >PythonCE mailing list > >PythonCE@python.org > >http://mail.python.org/mailman/listinfo/pythonce > > > > > > From mike at pcblokes.com Tue Mar 15 09:34:09 2005 From: mike at pcblokes.com (Michael Foord) Date: Tue Mar 15 09:34:15 2005 Subject: AW: [PythonCE] UnicodeDecodeError with print In-Reply-To: References: Message-ID: <42369E01.9020700@pcblokes.com> Thanks for the reply Sebastian - very helpful. I didn't know about ``sys.stdout.encoding`` which was part of the missing information. You filled in a lot more. The PDA itself is capable of displaying all sorts of weird and wonderful characters - I wonder if it's possible to access this functionality from pythonce ? I don't *need* to, I'm only curious. Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml anne.wangnick@t-online.de wrote: >Hello Michael, > >this can happen with "normal" Python as well, try this running python.exe >directly. >The issue is not that you create a unicode object, the issue is that you >want to print it. On the PC when using IDLE, sys.stdout.encoding is set to >"cp1252". For file objects, "when Unicode strings are written to a file, >they will be converted to byte strings using this encoding". > >On the PDA, however, sys.stdout is a built-in module _pcceshell_support. >Seemingly this module tries to convert unicode objects into strings using >the "ascii" encoding, and this stumbles on the pound sign. > >Thus, on the PDA, you have to take care of the conversion of unicode objects >to strings yourself before calling print. For instance: > u = u'?' > print u.encode("cp1252") > >Now this doesn't fail, but it doesn't print a pound sign as well. But at >least it seems to do the same as if you had written: > print '?' > >[It gets more interesting when the string '?' is contained in a source file. >Try to put the following into a file using IDLE on the PC, and run it: > # -*- coding: utf-8 -*- > print "?".encode("hex") >You'll get c2a3. This is because IDLE itself sees the first line of your >file, and encodes the pound sign as c2a3 when storing the file. > >Or try in a file: > # -*- coding: utf-8 -*- > print [hex(ord(c)) for c in u"?"] >This time, IDLE stored the pound sign as c2a3 again, but Python also uses >the magic first line when building the unicode object to convert c2a3 to a >unicode character. > >When you use Pocket Word, or so, to create a Python source file, it will of >course not understand your magic first line and bluntly store the pound sign >as a3. Thus, all of your string literals are actually cp1252-encoded.] > >Regards, >Sebastian > >-----Urspr?ngliche Nachricht----- >Von: pythonce-bounces@python.org [mailto:pythonce-bounces@python.org]Im >Auftrag von Michael Foord >Gesendet: Montag, 14. M?rz 2005 13:04 >An: pythonce@python.org >Betreff: [PythonCE] UnicodeDecodeError with print > > >I am wondering if anyone knows the reason as to why : > >print u'?' > >should cause a UnicodeDecodeError on pythonce ? (The usual 'ascii codec >cannot decode character...' message). > >Obviously the '?' character is a non-ascii character. I am just >surprised that the print statement is using the ascii encoding at all >and not just passing the string to sys.stdout. > >The particular reason I ask is that this doesn't happen with 'normal' >python... but I would like to know how the print statement decodes >unicode strings it prints. Since it *doesn't* raise an error normally it >obviously doesn't use defaultencoding - so why does the pyhonce one ? > >Yours curiously, > >Fuzzyman >http://www.voidspace.org.uk/python/index.shtml >_______________________________________________ >PythonCE mailing list >PythonCE@python.org >http://mail.python.org/mailman/listinfo/pythonce > > > > > > From isrgish at fastem.com Thu Mar 17 03:29:33 2005 From: isrgish at fastem.com (Isr Gish) Date: Thu Mar 17 03:36:28 2005 Subject: AW: [PythonCE] UnicodeDecodeError with print Message-ID: <20050317023626.8A4791E4004@bag.python.org> "Michael Foord" wrote: >The encoding that I need is ``sys.stdout.encoding`` not >``sys.defaultencoding`` (as I learned yesterday). Thanks for the reply >though... > I'm not clear what you meen by sys.stdout.encoding. As far as I can tell there no such thing. Also I think that when the default encoding is set it applies to stdout. Anyways thats what I thought till now. I guess I should check that out. All the best Isr P.s. After checking it it seems to work as I expected for I don't get an error. But one problem I have is that it just shows as a box not the character I want. Isr