Re: [PythonCE] Getting the win32 extensions working
- Original Message - From: "Andy Baker" <[EMAIL PROTECTED]> To: Sent: Monday, November 14, 2005 9:22 PM Subject: [PythonCE] Getting the win32 extensions working > Looking at this page: http://fore.validus.com/~kashtan/ it seems > fairly doable but I am not that familiar with compiling anything and > I am wary of it turning into a huge waste of time. By "not that familiar with compiling anything" does that mean you are not a C/C++ programmer? If so why can't you use the precompiled binary PythonCE? > > Does anyone have PythonCE compiled with the win32 extensions or has > anyone done the compilation and would be prepared to answer the odd > question should I attempt it myself? > > thanks in advance > > Andy Baker Yes, I've compiled pywin32 but I had to make some changes to get it to compile. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Getting the win32 extensions working
Download it and see for yourself: http://fore.validus.com/~kashtan/Python-2.3.4-arm-PPC2003.zip It contains only the win32gui and win32event modules of the pywin32 package. What parts do you need, and what do you intend to use it for? It doesn't contain any of the other modules like win32security, com, win32ui, etc. but some of them would not be relevant on Windows CE anyway. Luke - Original Message - From: "Andy Baker" <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]> Cc: Sent: Monday, November 14, 2005 11:06 PM Subject: Re: Getting the win32 extensions working Ah. I've re-read that page and I can see I might have misunderstood it. I was under the impression that you *had* to compile the sources if you wanted the win32 extensions.Is this not the case? Do the pre-compiled binaries already include the win32 stuff? As a quick related question, do you have any idea how much of the win32 extension module is supported under PythonCE? Fairly complete or not? cheers, AndyB On 11/14/05, Luke Dunstan <[EMAIL PROTECTED]> wrote: > > - Original Message - > From: "Andy Baker" <[EMAIL PROTECTED]> > To: > Sent: Monday, November 14, 2005 9:22 PM > Subject: [PythonCE] Getting the win32 extensions working > > > > Looking at this page: http://fore.validus.com/~kashtan/ it seems > > fairly doable but I am not that familiar with compiling anything and > > I am wary of it turning into a huge waste of time. > > By "not that familiar with compiling anything" does that mean you are not > a > > C/C++ programmer? If so why can't you use the precompiled binary PythonCE? > > > > > Does anyone have PythonCE compiled with the win32 extensions or has > > anyone done the compilation and would be prepared to answer the odd > > question should I attempt it myself? > > > > thanks in advance > > > > Andy Baker > > Yes, I've compiled pywin32 but I had to make some changes to get it to > compile. > > Luke > ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] PythonCE on the ARM emulator
- Original Message - From: "Thomas Heller" <[EMAIL PROTECTED]> To: Sent: Friday, December 16, 2005 2:10 AM Subject: [PythonCE] PythonCE on the ARM emulator > Since Luke Dunstan has ported ctypes to windows CE, so I got interested > in this platform. I don't have a Windows CE device, but I found the MS > Device Emulator (1.0, Community Preview): > > http://msdn.microsoft.com/mobility/windowsmobile/downloads/emulatorpreview/default.aspx > > To get started, I installed the emulator and tried to install the > current CE binaries on it. The interactive interpreter works as far as > I can tell, except that I cannot import any extension modules in it. > When I try this, 'import _winreg' or 'import socket', Python is > terminated without any indication what was wrong. > > Has anyone with more experience tried to run Python on this 'platform'? > > Thanks, > > Thomas I just tried this and I get the same results. Running it in the debugger shows that the crash occurs in GetPythonImport() in Python/dynload_win.c. The code calls LoadLibrary() and then assumes that the returned HMODULE is actually the base address of the DLL in memory, which is true for other versions of Windows. The code tries to read the import table from the DLL file headers to determine whether it is linked to the correct version of Python (python23.dll in this case). I checked on my PDA and even though it tries to read from an invalid address it does not crash, so it doesn't cause any problems. Apparently the emulator has better memory protection (or perhaps it is the slightly newer OS running on the emulator) and doesn't allow this. The ideal solution to this problem would be to find the real module address from the HMODULE: does anyone know how to do this? The easy solution would be to use #ifndef MS_WINCE around this code because it is not critical and is merely a safeguard against loading Python extensions for the wrong version of Python. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] PythonCE on the ARM emulator
I have tried the simple solution of disabling the version check and I was able to install and run the ctypes unittests on the ARM emulator. -- Ran 269 tests in 168.000s OK Thomas: I can give you the build of Python that I used, if you want. Luke - Original Message - From: "Luke Dunstan" <[EMAIL PROTECTED]> To: "Thomas Heller" <[EMAIL PROTECTED]> Cc: Sent: Saturday, December 17, 2005 11:04 AM Subject: Re: [PythonCE] PythonCE on the ARM emulator > > - Original Message - > From: "Thomas Heller" <[EMAIL PROTECTED]> > To: > Sent: Friday, December 16, 2005 2:10 AM > Subject: [PythonCE] PythonCE on the ARM emulator > > >> Since Luke Dunstan has ported ctypes to windows CE, so I got interested >> in this platform. I don't have a Windows CE device, but I found the MS >> Device Emulator (1.0, Community Preview): >> >> http://msdn.microsoft.com/mobility/windowsmobile/downloads/emulatorpreview/default.aspx >> >> To get started, I installed the emulator and tried to install the >> current CE binaries on it. The interactive interpreter works as far as >> I can tell, except that I cannot import any extension modules in it. >> When I try this, 'import _winreg' or 'import socket', Python is >> terminated without any indication what was wrong. >> >> Has anyone with more experience tried to run Python on this 'platform'? >> >> Thanks, >> >> Thomas > > I just tried this and I get the same results. Running it in the debugger > shows that the crash occurs in GetPythonImport() in Python/dynload_win.c. > The code calls LoadLibrary() and then assumes that the returned HMODULE is > actually the base address of the DLL in memory, which is true for other > versions of Windows. The code tries to read the import table from the DLL > file headers to determine whether it is linked to the correct version of > Python (python23.dll in this case). I checked on my PDA and even though it > tries to read from an invalid address it does not crash, so it doesn't > cause > any problems. Apparently the emulator has better memory protection (or > perhaps it is the slightly newer OS running on the emulator) and doesn't > allow this. > > The ideal solution to this problem would be to find the real module > address > from the HMODULE: does anyone know how to do this? The easy solution would > be to use #ifndef MS_WINCE around this code because it is not critical and > is merely a safeguard against loading Python extensions for the wrong > version of Python. > > Luke > ___ > 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
Re: [PythonCE] PythonCE on the ARM emulator
- Original Message - From: "Thomas Heller" <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]> Cc: "Thomas Heller" <[EMAIL PROTECTED]>; Sent: Tuesday, December 20, 2005 3:22 AM Subject: Re: [PythonCE] PythonCE on the ARM emulator > "Luke Dunstan" <[EMAIL PROTECTED]> writes: > >> I have tried the simple solution of disabling the version check and I >> was able to install and run the ctypes unittests on the ARM emulator. >> >> >> -- >> Ran 269 tests in 168.000s >> >> OK >> >> Thomas: I can give you the build of Python that I used, if you want. >> > That would be great, although I really should be able to compile (and > debug!) this myself. If I do this, I would want to quickly move from > Python 2.3.4 to 2.4.2. Or is there any reason not to try this, on CE? > > Thomas Unfortunately I don't have an appropriate place my Python builds, so could you suggest somewhere? Of course I eventually want it to become part of the PythonCE project, so perhaps the developers of that project would be kind enough to allow me to upload new builds, marked as "alpha" or "snapshots" for now? I think moving to version 2.4.2 is a good idea but I doubt it will be trivial and I think it will distract from the current task verifying that my port of ctypes works as you expect. I think it is better to focus on the working version of Python we have at the moment and upgrade later. Is there any specific problem with using Python 2.3? Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Hello and some questions
- Original Message - From: "Info4HiDeVis" <[EMAIL PROTECTED]> To: Sent: Monday, December 26, 2005 2:31 AM Subject: [PythonCE] Hello and some questions > hello and greez for all listmembers, > i'm new here and i have this maillinglist subricted to find out more > about Python at PDA's. > On PC i coding in Python and i like this language. Now i want write > programms for my new > PDA (FSC Loox N520) but i have some questions: > 1) what python-version will work with my Windows Mobile 5.0? I would suggest that you just download the latest one you can find and try it. An interesting list is at: http://www.traybor.com/PythonCE/ > 2) what are the fundamentaly differences between Python on Windows and PDA Basically the differences are those that result from the differences between desktop Windows and Windows CE, for example, Windows CE does not have pipes so operating system functions like popen are not available. There are also some differences due to some modules not having been ported to Windows CE yet, e.g. pyexpat (at least in PythonCE 2.3.4). > 3) what is the best solution for coding for PDA's (menas Editor and so on) I think the best way to write PythonCE programs is to do it on desktop Windows, test them on the desktop and then transfer them to the PDA. If you need to write the code on the PDA then I don't know of any IDEs or particularly good text editors (because I haven't looked much) but I think there are quite a few text editors available. > > my last question is for this maillinglist: > some maillinglists are also readable as news-group (for example: > dzug.org) - is it for this > maillinglist possible too? this can make the reading and writing over > the mail-client more easier. I don't know the answer to this question. Luke > > thx and YES: i have not english as my motherlanguage *gg* > torty > ___ > 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
[PythonCE] Python 2.3.5 for Windows CE / ARM (Pocket PC 2003)
A new release of Python for Windows CE is available. Download it here: http://sourceforge.net/project/showfiles.php?group_id=104228 The release notes are linked from this page, but a direct link is: http://sourceforge.net/project/shownotes.php?group_id=104228&release_id=382495 Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Yes, please compile it...
I'm not sure what you are trying to say. In an earlier message you replied to my announcement of the Python 2.3.5 release, but now you seem to be asking for a binary release. If so, have you tried the release? Rodrigo and Jeffrey, I also invite you to download the binaries mentioned in my email of a few days ago: http://mail.python.org/pipermail/pythonce/2006-January/001207.html Luke - Original Message - From: "Andy Baker" <[EMAIL PROTECTED]> To: Sent: Saturday, January 07, 2006 12:01 AM Subject: Re: [PythonCE] Yes, please compile it... I've always had a complete nightmare everytime I've tried to compile something from source. I'm sure lots of people who are competant in Python are lost in the world of makefiles and such-like so I would like to vote for always keeping an up-to-date binary available. Andy Baker On 1/6/06, Rodrigo Contreras Köbrich <[EMAIL PROTECTED]> wrote: > Hi. > I'm having the same troubles. > ___ > 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 ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Empty project or Human Friendly Project?
If you are not at all familiar with SourceForge then I can imagine that you might have missed the binary releases. First go here: http://sourceforge.net/project/showfiles.php?group_id=104228 Under the package "pythonce" you will see a number of "releases", including: Python-2.3.5-20051223 Python-2.3.4/HPC-2000 Python/CE 2.3.4-1 Each release has a +/- button next to it to expand the list of files contained in that release, but the first one (2.3.5) should already be expanded. Next to each release you will also see a link [Notes] which shows the release notes. Please read the release notes for the 2.3.5 release: http://sourceforge.net/project/shownotes.php?release_id=382495&group_id=104228 >From there you should be able to figure out which files to download. Basically though, the zip files contain the source and the file "PythonCE-2.3.5-20051223-setup.exe" contains the binary installer. Here is a direct link to file, where you can select a download mirror or use the default: http://prdownloads.sourceforge.net/pythonce/PythonCE-2.3.5-20051223-setup.exe?download As for the web page, I agree that it would be nice to have something there but writing web pages is not really my area of expertise or interest, so you are welcome to write something yourself. I would prefer a wiki for the main documentation so maybe we can either create one or use an existing one like http://wiki.python.org/moin/FrontPage or http://www.murkworks.com/Research/Python/PythonCE/PythonCEWiki/FrontPage ??? Luke - Original Message - From: "Rodrigo Contreras Köbrich" <[EMAIL PROTECTED]> To: Sent: Saturday, January 07, 2006 12:19 AM Subject: [PythonCE] Empty project or Human Friendly Project? > I'm sure that the pythonce project will be one of the most exiting > things happening in the future of mobile devices. I hate java, so i will > support python till the end. > But as Andy Baker just said "lots of people who are competent in Python > are lost in the world of makefiles" and I must say that the Sourceforge > page doesn't help at all. > The forum is almost empty, there's is only one bug reported and when you > click on the "home page" link you find out that there is NO HOME PAGE. > Such a project with such few content. The only way to succeed here will > be showing the efforts of the project... In Sourceforge there are rather > hidden... > > I think there are two critical items missing in the TODO list: > > 1. A compiled version of pythonce. > 2. A human readable and user friendly homepage (and yes, a blog would be > just fine to show advances and related news). > > Bye. > > rc. > ___ > 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
Re: [PythonCE] Empty project or Human Friendly Project?
SourceForge provides hosting with nice features like scripting and MySQL, documented here: http://sourceforge.net/docman/display_doc.php?docid=4297&group_id=1 Alternatively, a project administrator can change the "Home Page" link to point to another site. It's not obvious to me how to edit the MurkWorks wiki but hopefully editing is just disabled temporarily. Luke - Original Message - From: "Stewart Midwinter" <[EMAIL PROTECTED]> To: "Rodrigo Contreras Köbrich" <[EMAIL PROTECTED]> Cc: Sent: Saturday, January 07, 2006 12:59 AM Subject: Re: [PythonCE] Empty project or Human Friendly Project? tienes razón Rodrigo! The SF project doesn't have a home page. Perhaps one of the current developers, bkc, kashtan, pfalcon can make it happen or delegate the job to one of us (I can help). Do we get a space on SF to create the home page, or do we have to host it elsewhere? If so, I note that the domain pythonce.org is available! cheers, -- Stewart Midwinter Python 2.3.4 on Toshiba e830 [EMAIL PROTECTED] [EMAIL PROTECTED] Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad AIM:midtoad1 ___ 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
Re: [PythonCE] Tkinter in pythonce...
- Original Message - From: "Stewart Midwinter" <[EMAIL PROTECTED]> To: "Rodrigo Contreras Köbrich" <[EMAIL PROTECTED]> Cc: Sent: Saturday, January 07, 2006 11:49 AM Subject: Re: [PythonCE] Tkinter in pythonce... > Rodrigo, no desesperes! > > Where do you have your python located? > > You probably need to add some code that tells python where to look for > modules. you can do that with: > sys.path.append('\\SD Card\\Program Files\\Python\\Lib') > sys.path.append('\\SD Card\\Program > Files\\Python\\Lib\\python23.zip\\lib-tk') This is not necessary because both of these directories are automatically in sys.path (just as on the desktop version of Python). If this is not the case then it is a bug. > > (of course, change that to the location where your python is located). > > if you put the above into a file called sitecustomize.py in your > python folder, whenever it starts, it will read this file so you don't > have to put the code into your apps. Thanks for the tip. I haven't used sitecustomise.py before but I do use .pth files to add my own directories to the search path. > Inside your python folder, you should have a lib folder which contains > a pyton23.zip and a _tkinter.pyd. you may also have a > setup-registry.py, which will edit your registry so that you can just > double-click on python files to run them. This is true of the 2.3.4 release but in the latest release the hierarchy looks like: \Program Files\Python\ - python.exe - python23.zip - python23.dll - DLLs\ - _tkinter.pyd - Lib\ This is intended to be the same as the desktop version of Python on Windows (except for the .zip file). > > You may also want to look around for a copy of osce.py, which gives > you access to some of the features of the 'os' module on the desktop. > > HTH > S You should already have an 'os' module. Or are there some specific functions that it doesn't include? Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Compiled version of Python 2.3.5 for Windows CE?
- Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Saturday, January 07, 2006 3:38 AM Subject: [PythonCE] Compiled version of Python 2.3.5 for Windows CE? Thank you for the additional information. The description of PythonCE-2.3.5-20051223-setup.exe in the release notes says that the program registers the .cab file and allows easy installation, but doesn't mention that it includes the binary. Maybe that's obvious to people who know Windows CE better than I do. Perhaps the wording can be improved, but have you ever installed source code from an .exe file or a Windows CE .cab file? I haven't. I have managed to install PythonCE-2.3.5. There is an icon and tapping it runs python 2.3.5. I can import wx and Pyro. However, when I tap on one of my programs (using file explorer), I now get the message: The file 'xxx' cannot be opened. Either it is not signed with a trusted certificate, or one of its components cannot be found. You might need to reinstall or restore this file. I haven't seen this specific error message but I assume it is due to .py files not being properly associated with python.exe. Did I do something wrong in the installation? -- Jeffrey Barish No, I simply haven't added the file associations to the CAB installer yet. I will try to do this for the next release but in the mean time copy the attached setup-registry.py to your PDA, run Python and then type: execfile('\\program files\\python\\setup-registry.py') The script can be placed anywhere though, this is just an example path. Luke # # Setup the registry to allow us to double click on python scripts # from _winreg import * import sys print "Setting up registry to allow\ndouble clicking of Python files to work" # # Create the registry entries for ".py" and ".pyc" extensions # for Name in (".py", ".pyc"): Key = CreateKey(HKEY_CLASSES_ROOT, Name) SetValue(Key, None, REG_SZ, "Python.File") CloseKey(Key) # # Create HKEY_CLASSES_ROOT\Python.File\Shell\Open\Command = "\Program Files\Python\Lib\Python.exe" "%1" # Key = CreateKey(HKEY_CLASSES_ROOT, "Python.File") for Name in ("Shell","Open","Command"): New_Key= CreateKey(Key, Name) CloseKey(Key) Key = New_Key SetValue(Key, None, REG_SZ, '"' + sys.executable + '" "%1"') CloseKey(Key) import time time.sleep(5) ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Tkinter in pythonce 2.3.5...
Sorry, I was mistaken about one thing though: python23.zip\\lib-tk is not in sys.path by default (only Lib\\lib-tk is, but the Tkinter files are in the zip so that doesn't help). Luke - Original Message - From: "Stewart Midwinter" <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]> Cc: Sent: Saturday, January 07, 2006 12:13 PM Subject: Re: [PythonCE] Tkinter in pythonce... thanks for the extra details on 2.3.5. I can see now that it's different from 2.3.4. and more compatible with the desktop version. I'd better install it and find out more! my comments about osce.py were directed at 2.3.4. Perhaps the newer version doesn't need it, or may not be able to use it. cheers S ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Tkinter in pythonce...
- Original Message - From: "Rodrigo Contreras Köbrich" <[EMAIL PROTECTED]> To: Sent: Saturday, January 07, 2006 3:28 AM Subject: [PythonCE] Tkinter in pythonce... > Hi. > > I installed the CAB file in my PDA. > The first thing I wanted to test was the GUI capabilities, so I tried to > run the following code (which compiles nicely in the PC version): > > from Tkinter import * The first thing I should say is that I know very little about Tkinter/Tcl/Tk so I'm not really personally able to support this part of the PythonCE port. The installer does include _tkinter.pyd merely as a convenience but it does not include the Tcl/Tk DLLs, partly because as I said I don't know enough about them but also because they are too large to include when only some people will use them. The Python part of Tkinter is also included but unfortunately they are not in the default sys.path. As per Stewart's suggestion you can use sitecustomize.py or another method to add '\\Program Files\\Python\\python23.zip\\lib-tk' to sys.path. In the next release I hope to fix this to be automatic. You still need to get Tcl/Tk DLLs from elsewhere though. Luke > root = Tk() > > myContainer1 = Frame(root) ### (1) > myContainer1.pack() ### (2) > > root.mainloop() > > But pythonce raises an error code: No module named Tkinter. > > I noticed that there is a file named '_tkinter.pyd' at the DLLs folder. > What should I do? > > Bye. > ___ > 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
Re: [PythonCE] Web site (was Re: Empty project or Human Friendly Project?)
- Original Message - From: "Brad Clements" <[EMAIL PROTECTED]> To: Sent: Saturday, January 07, 2006 3:38 AM Subject: Re: [PythonCE] Empty project or Human Friendly Project? > On 6 Jan 2006 at 10:09, Stewart Midwinter wrote: > >> Either would be fine by me. The wiki at murkworks is already set up >> and specific to this project, so easier to start with. I note however >> that the last entry there was 3 years ago. Brad Clements, the wiki >> admin, is one of the pythonce developers though, so Brad can you tell >> us if the location is still considered 'temporary' or whether we could >> make use of it for some time? > > The wiki is not intended to be temporary. It's an old version of zwiki, > should > probably be updated and I need to do something about self-provisioning > accounts. I think it's closed to editing due to spam. > >> >> Luke, is it possible to create a home page on SF that does nothing >> more than redirect to another location? Must be, since I see other >> projects doing something similar. I'll be happy to sign up and make >> it happen, if it will help. > > I can make a redirect page easily enough. But having a wiki for the home > page > sufficient? I think having a wiki is the best first step since we have nothing at the moment. Already a few people have volunteered to help with the web page, and if we can immediately give them a wiki to edit then it avoids the hassle, the risks and the learning curve of giving them direct access to your web server. > Should I setup a Trac site instead? I haven't used Trac but it sounds like it includes things like bug tracking which SourceForge already provides so I wouldn't want to duplicate that (it would be more work to maintain too). What else does it provide that SourceForge doesn't? > What about spam control? I don't know the answer to that. The only other project that I am a developer on and that has a wiki is www.mingw.org but I have never seen spam on that wiki. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] PythonCE Digest, Vol 30, Issue 6
- Original Message - From: "Duane Blanchard" <[EMAIL PROTECTED]> To: Sent: Saturday, January 07, 2006 8:27 AM Subject: Re: [PythonCE] PythonCE Digest, Vol 30, Issue 6 > Hi, I've been lurking on the list and playing a little with PythonCE. > Very cool stuff here. Thanks to all the developers, many thanks. I'm > not a very talented coder, yet, but am willing to do the footwork of > getting an SF page for the project. It seems to me that everyone would > want this. Are there any objections before I go ahead and do it? > > Thanks, > > Duane Your offer is welcome, but in order to create the web page you would first need to be added as a developer by one of the project administrators. We are also discussing whether to host the web page on SourceForge or on Brad Clement's web server (which already has an old PythonCE wiki), so stay tuned. By the way, if you reply to a digest then it would be nice if you could edit the Subject to be something meaningful and delete the text quoted from the digest, except for the parts you are specifically replying to. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] How do you develop on the PocketPC?
I sometimes use interactive commands, but usually through a program called ActiveSync Remote Display which is like Remote Desktop. Other times I do double-click on scripts, and it is possible (but inconvenient) to see the error messages by switching to the Python window. I have been planning on creating some tools to help this process but maybe you've already done that? Your script would be appreciated. Luke - Original Message - From: "Thomas Heller" <[EMAIL PROTECTED]> To: Sent: Monday, January 09, 2006 8:51 PM Subject: [PythonCE] How do you develop on the PocketPC? > Does anyone (everyone ?) start the Python interpreter on the device, and > use the stylus to enter interactive commands? > Or does one write scripts on the PC, let ActiveSync transfer them, and > start them by clicking on the filename? > > I cannot really believe that. BTW, when an uncatched exception occurs > in a script, I see a box displaying: > > """ > Python Error > > Traceback (innermost last): > : > """ > > When I close this box (by clicking the OK button in the upper right > corner), I can see (for less than a second) the interpreter window > showing the real traceback, but not long enough to be able to read it. > > So, I made a pair of scripts which start a server on the host PC, which > sends commands to a script running on the device, executing them, and > send the results back for display on the PC. Don't know if it is worth > to post it here... > > Thomas ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] How do you develop on the PocketPC?
I'm sorry to say that I've seen the NULL bug before but have been too distracted by the task at hand to fix it, but here is a patch that fixes it. By the way, I've recently tried running the remote part of "winpdb" (http://www.digitalpeers.com/pythondebugger/) on Windows CE and connecting to it over TCP/IP from the GUI running on the PC, and after a trivial change (to handle a lack of PATH environment variable) it worked fine. Personally I would rather have the ability to communicate to the remote debugger using ActiveSync rather than only TCP/IP because it is more convenient especially since I only have Bluetooth not WiFi, so I have been investigating using the Remote API (RAPI). Luke - Original Message - From: "Thomas Heller" <[EMAIL PROTECTED]> To: Sent: Monday, January 09, 2006 8:51 PM Subject: [PythonCE] How do you develop on the PocketPC? Does anyone (everyone ?) start the Python interpreter on the device, and use the stylus to enter interactive commands? Or does one write scripts on the PC, let ActiveSync transfer them, and start them by clicking on the filename? I cannot really believe that. BTW, when an uncatched exception occurs in a script, I see a box displaying: """ Python Error Traceback (innermost last): : """ When I close this box (by clicking the OK button in the upper right corner), I can see (for less than a second) the interpreter window showing the real traceback, but not long enough to be able to read it. So, I made a pair of scripts which start a server on the host PC, which sends commands to a script running on the device, executing them, and send the results back for display on the PC. Don't know if it is worth to post it here... Thomas null-exception-fix.diff Description: Binary data ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] How do you develop on the PocketPC?
- Original Message - From: "Thomas Heller" <[EMAIL PROTECTED]> To: Sent: Monday, January 09, 2006 10:42 PM Subject: Re: [PythonCE] How do you develop on the PocketPC? "Luke Dunstan" <[EMAIL PROTECTED]> writes: I'm sorry to say that I've seen the NULL bug before but have been too distracted by the task at hand to fix it, but here is a patch that fixes it. By the way, I've recently tried running the remote part of "winpdb" (http://www.digitalpeers.com/pythondebugger/) on Windows CE and connecting to it over TCP/IP from the GUI running on the PC, and after a trivial change (to handle a lack of PATH environment variable) it worked fine. Personally I would rather have the ability to communicate to the remote debugger using ActiveSync rather than only TCP/IP because it is more convenient especially since I only have Bluetooth not WiFi, so I have been investigating using the Remote API (RAPI). In case you are talking about the scripts I posted: Although the client and server connect via TCP/IP, the only connection between the pockect PC and the desktop computer I have is the cradle with an USB cable, plus activesync (3.8, IIRC) running. It seems activesync emulates internet connection on the pocket pc. Thomas I have noticed that IE works on the PDA when cradled, but I know that ActiveSync is not providing a real network adapter on the PC side because an extra IP does not appear in the output of 'ipconfig'. This prevents running TCP listen servers on the PDA but it is true that your method works nicely in this case. As a demonstration of how we could make it even more convenient, I have modified it slightly so that the server starts the client script on the PDA remotely, using RAPI via ctypes. I have put the experimental RAPI interfacing code in a separate module "wincerapi". We should probably consider putting all these scripts in CVS somewhere. Luke # Thomas Heller 20060109 # Start this script on the PC, then start client.py on the Pocket PC. import socket, sys, threading import wincerapi # Initialise RAPI wincerapi.CeRapiInitTimeout() # Start the client program on the device DEVICE_PYTHON_EXE = '\\Program Files\\Python\\python.exe' DEVICE_SCRIPT = '\\my documents\\python\\pyceclient.py' wincerapi.RunProcess(DEVICE_PYTHON_EXE, '"' + DEVICE_SCRIPT + '"') HOST = '' # Symbolic name meaning the local host PORT = 2 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) conn, addr = s.accept() def get_input(): while 1: data = raw_input() conn.send(data + '\n') t = threading.Thread(target=get_input) t.setDaemon(True) t.start() while 1: data = conn.recv(1024) if not data: print "SystemExit, hit return to end." raise SystemExit sys.stderr.write(data) # vi:ts=4:sw=4:et import ctypes from ctypes.com import STDMETHOD from ctypes.com.storage import IStream _rapi = ctypes.windll.rapi ### # # Internal helpers # _DWORD = ctypes.c_ulong _WCHAR = ctypes.c_wchar _BOOL = ctypes.c_int def _SUCCEEDED(hr): return hr >= 0 def _FAILED(hr): return hr < 0 ### # # Error handling # CeRapiGetError = _rapi.CeRapiGetError CeRapiGetError.argtypes = [] CeRapiGetError.restype = _DWORD # really a HRESULT CeGetLastError = _rapi.CeGetLastError CeGetLastError.argtypes = [] CeGetLastError.restype = _DWORD class RapiError(Exception): """This error is raised by some functions in this module when an error occurs""" def __init__(self, message): self.rapi_errno = CeRapiGetError() self.ce_errno = CeGetLastError() if self.rapi_errno == 0: if self.ce_errno == 0: msg = message + " (No error code)" else: msg = "%s (CeGetLastError: %d)" % (message, self.ce_errno) else: msg = "%s (CeRapiGetError: %d)" % (message, self.rapi_errno) Exception.__init__(self, msg) ### # # Initialisation # class RAPIINIT(ctypes.Structure): _fields_ = [ ("cbSize", _DWORD), ("heRapiInit", _DWORD), ("hrRapiInit", ctypes.HRESULT), ] def __init__(self): self.cbSize = ctypes.sizeof(self) CeRapiInitEx = _rapi.CeRapiInitEx CeRapiInitEx.argtypes = [ ctypes.POINTER(RAPIINIT) ] CeRapiInitEx.restype = ctypes.HRESULT CeRapiUninit = _rapi.CeRapiUninit CeRapiUninit.argtypes = [] CeRapiUninit.restype = ctypes.HRESULT def CeRapiInitTimeout(timeout_ms = 5000): """Initialises the RAPI connection, failing if it does not succeed
Re: [PythonCE] How do you develop on the PocketPC?
- Original Message - From: "Thomas Heller" <[EMAIL PROTECTED]> To: Sent: Tuesday, January 10, 2006 2:47 AM Subject: Re: [PythonCE] How do you develop on the PocketPC? > "Luke Dunstan" <[EMAIL PROTECTED]> writes: >> We should probably consider putting all these scripts in CVS somewhere. > > And we should probably use the pocketRapi module that Brian Brown > posted. I am interested to know why you prefer it. I can think of the following advantages: - It initialises RAPI the first time you try to use it, and remembers this. - It includes more file I/O functions. I'm sure it is good for some purposes, but I can also think of some possible disadvantages: - The functions are in a class instead of a module. This means that you could create multiple instances of the class, which doesn't make sense. - The name "pocketRapi" implies Pocket PC only but RAPI really applies to Windows CE in general. - It requires win32file. - The file I/O functions do not follow the pattern of Python file objects. - It doesn't include the last error codes in exceptions raised. - It doesn't use "argtypes" or "restype". I don't know if this makes it faster? - Redistributions in "binary form" must reproduce the copyright notice. Luke > There are important things missing, IMO: the ability to interrupt > running code with ^C, and to terminate the session with typing ^Z. > Unfortunately, I have not even be able to distinguish ^C from ^Z in the > get_input() function. It seems that both raise an EOFError in the > thread that get_input() runs. Maybe we cannot use raw_input, and have > to write our own function for that... > > Thomas > > ___ > 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
Re: [PythonCE] How do you develop on the PocketPC?
It could be of use but personally I would prefer to use ctypes because I find it much faster and easier to develop the module in Python than C/C++/SWIG, and for users of the module it is easier to read the Python code to understand how it works. Thanks also for the reminder that the name "wincerapi" is already taken. Luke - Original Message - From: "Mark Hammond" <[EMAIL PROTECTED]> To: " Luke Dunstan" <[EMAIL PROTECTED]>; Sent: Tuesday, January 10, 2006 6:07 PM Subject: RE: [PythonCE] How do you develop on the PocketPC? > There is also a languishing wincerapi module in the pywin32 source code. > Is > that of use to anyone? > > Mark. > >> > "Luke Dunstan" <[EMAIL PROTECTED]> writes: >> >> We should probably consider putting all these scripts in CVS >> >> somewhere. >> > >> > And we should probably use the pocketRapi module that Brian Brown >> > posted. >> >> I am interested to know why you prefer it. I can think of the following >> advantages: >> >> - It initialises RAPI the first time you try to use it, and >> remembers this. >> - It includes more file I/O functions. >> >> I'm sure it is good for some purposes, but I can also think of >> some possible >> disadvantages: >> >> - The functions are in a class instead of a module. This means that you >> could create multiple instances of the class, which doesn't make sense. >> - The name "pocketRapi" implies Pocket PC only but RAPI really applies to >> Windows CE in general. >> - It requires win32file. >> - The file I/O functions do not follow the pattern of Python file >> objects. >> - It doesn't include the last error codes in exceptions raised. >> - It doesn't use "argtypes" or "restype". I don't know if this makes it >> faster? >> - Redistributions in "binary form" must reproduce the copyright notice. >> >> Luke >> >> > There are important things missing, IMO: the ability to interrupt >> > running code with ^C, and to terminate the session with typing ^Z. >> > Unfortunately, I have not even be able to distinguish ^C from ^Z in the >> > get_input() function. It seems that both raise an EOFError in the >> > thread that get_input() runs. Maybe we cannot use raw_input, and have >> > to write our own function for that... > > ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] How do you develop on the PocketPC?
- Original Message - From: "Thomas Heller" <[EMAIL PROTECTED]> To: Sent: Wednesday, January 11, 2006 3:42 PM Subject: Re: [PythonCE] How do you develop on the PocketPC? > "Luke Dunstan" <[EMAIL PROTECTED]> writes: > >> - Original Message - >> From: "Thomas Heller" <[EMAIL PROTECTED]> >> To: >> Sent: Monday, January 09, 2006 10:42 PM >> Subject: Re: [PythonCE] How do you develop on the PocketPC? >> >> I have noticed that IE works on the PDA when cradled, but I know that >> ActiveSync is not providing a real network adapter on the PC side >> because an extra IP does not appear in the output of 'ipconfig'. This >> prevents running TCP listen servers on the PDA but it is true that >> your method works nicely in this case. > > Luke, > > Do you know of any other way except TCP/IP to establish a two-way > communication between the desktop and the PDA? > > Thomas One way I know is using the CeRapiInvoke() API, which is a kind of remote procedure call: STDAPI_( HRESULT ) CeRapiInvoke( LPCWSTR pDllPath, LPCWSTR pFunctionName, DWORD cbInput, BYTE * pInput, DWORD * pcbOutput, BYTE ** ppOutput, IRAPIStream ** ppIRAPIStream, DWORD dwReserved ); You can specify a DLL and function name and the device-side part of RAPI will load the DLL and call the function, but it must have the following prototype (see also wincerapi.py): typedef HRESULT (STDAPICALLTYPE RAPIEXT)( DWORD cbInput, BYTE * pInput, DWORD * pcbOutput, BYTE ** ppOutput, IRAPIStream * pIRAPIStream ); In block mode (ppIRAPIStream == NULL) you can simply pass a block of data in each direction. The interesting part is that if you pass a pointer then you will receive a IRAPIStream* that allows the device and PC to communicate in both directions similar to a socket. I have tested this in one direction only using the CeInvoke sample from the Pocket PC 2003 SDK, and I also tested replacing the desktop-side program with a Python script. However, so far this API does not seem robust; for example if the device-side DLL releases the stream then IRAPIStream::Read() seems to block forever in the desktop program. The CeInvoke sample handles this by sending a command over the stream to let the desktop know that it has finished, but to my mind it is a hack because it would be like sending a disconnect command over a TCP socket and relying on that to shut down the other end. The function IRAPIStream::SetRapiStat can supposedly set a timeout for Read() but so far I can't get it to work. There is a two-way stream sample in an MSDN KB article that I have yet to try. For creating development tools there is also the possibility of using the Platform Manager APIs, which are installed and used by eMbedded Visual C++ to communicate with the remote debugger, among other things. Platform Manager supports multiple "transports" including TCP/IP and ActiveSync and you can even create your own transport. I haven't actually tried using it yet though :-). Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] rudimentary pythonce home page setup
Thanks. Looking forward to the new wiki... Luke - Original Message - From: Brad Clements To: pythonce@python.org Sent: Thursday, January 12, 2006 7:38 AM Subject: [PythonCE] rudimentary pythonce home page setup http://pythonce.sourceforge.net/ checked into cvs as web module. I am planning on migrating the existing pythonce wiki to moinmoin, unless someone has a better idea? Note that moinmoin folks so "don't bother to host on sf, too slow", so I'll put the new wiki at murkworks.com I'm not sure what content to put on the pythonce home page, so it's spartan. -- Brad Clements, [EMAIL PROTECTED] (315)268-1000 http://www.murkworks.com AOL-IM or SKYPE: BKClements ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] How do you develop on the PocketPC?
- Original Message - From: "Thomas Heller" <[EMAIL PROTECTED]> To: Sent: Saturday, January 14, 2006 2:32 AM Subject: Re: [PythonCE] How do you develop on the PocketPC? > We have three more or less complete and tested rapi modules. I have to > admit that after reading it I like Luke's module better than the > TechGame one, although I found at least one error in it (CeCreateProcess > must take a pointer to PROCESS_INFORMATION). Note that PROCESS_INFORMATION contains an "_as_parameter_" property that takes the address for you. I would agree to removing this though because it may be more confusing than convenient. > We have the script that I posted which implements the start of a remote > Python interpreter. I don't know what others think of it, but I find it > pretty cool, it lets me try out code on the PDA without having to fiddle > with this stick ;-). I forgot to mention it earlier but I am actually using your script most of the time instead of the default PythonCE shell :-). > How should we proceed? > > Create a development environment for CE, based on ctypes? I think everyone will have different ideas of what a "development environment for CE" should be, and a wiki page is probably a good way to collect the ideas. It would also be nice if an existing IDE or something could be modified and extended to allow remote development for Windows CE, because it would save a lot of time compared to creating it from scratch. Off the top of my head I would like an IDE with the following features: - Remote interactive Python shell like the one you posted - Source code editor with the usual features (to be elaborated later) - Integrated remote debugger like winpdb - GUI written in wxPython (this is just my preference and the reasons can be discussed later) - Preferably doesn't require manual installation of device-side components apart from the standard PythonCE, i.e. it should install the rest automatically - Perhaps an integrated remote display function like ActiveSync Remote Display or VNC, because this would be important for developing graphical Python apps for Windows CE That should be enough to kick off discussion. > Where should the repository be? I think it should be part of the PythonCE project on SourceForge because I imagine it would appeal to most users and because I think it is too small to require a separate project at this stage. > Who is interested in developing it? I am interested in working on it but I will be going on holiday soon for around 3 weeks, so I won't be available immediately. > > And so on. > > For ctypes, wrapping the *complete* rapi functions would be an > interesting experiment, also for automated code generation. Large > enough to be interesting, small enough to be ready in limited time. > > Thomas Yes, it would be interesting and I may try it some time. So many ideas, so little time :-). Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Spinner
This happens in GUI applications because the PythonCE shell thinks that the program is busy even though it may simply be in a message loop. One way to get rid of the wait cursor is: import _pcceshell_support _pcceshell_support.Busy(0) Luke - Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Wednesday, February 15, 2006 7:42 AM Subject: [PythonCE] Spinner > Does anyone know why I get the spinner over any Python application that I > run? > The application seems to be running fine even though I am supposed to wait > for something. > -- > Jeffrey Barish > ___ > 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
Re: [PythonCE] Spinner
I am not aware of documentation on _pcceshell_support, and to be honest I only discovered it in the PythonCE source code because you asked the question. Previously I had worked around the problem using SetCursor() but this is a cleaner solution. Actually this module is designed to be used internally by PythonCE but it could still be useful. For the benefit of the mailing list, I will describe what I can see in the code. It has the following methods: Terminate() - exits PythonCE immediately write(text) - writes a string to the output window flush() - flushes buffered data to the output window Busy(busyFlag) - changes whether the wait cursor is displayed Wait() - waits for either the application to be closed (returns 0) or for console input to become available (returns 1) Get_Input_Text() - returns the text entered at the prompt Character_Input(ordinal) - sends a character to the output window Get_Edit_Window_Line(lineNum) - returns the text on the specified line of the output window As for taking control of the whole screen, I see that there is an API SHFullScreen() described in the Microsoft documentation that probably does what you want. To use this from PythonCE you would need to either use ctypes or write a Python extension module. ctypes was just released: http://sourceforge.net/project/showfiles.php?group_id=71702 I haven't actually tried this release yet but I've used slightly earlier versions of ctypes from CVS so I'm sure it will work (assuming you are using 2.3.5). Luke - Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Friday, February 17, 2006 6:07 AM Subject: Re: [PythonCE] Spinner Your suggestion solved the problem. I am in awe of your erudition. Is there documentation on this module? I am wondering whether it is capable of additional magic about which I should know more. Here are more questions for the list that I think are esoteric: I intend that the PDA run only my application. Is there a way to run a program so that it consumes the entire screen (without all the Microsoft stuff at the top)? Also, what is the best way to get the program to run automatically when the PDA reboots? On Thursday 16 February 2006 04:00, [EMAIL PROTECTED] wrote: > Message: 1 > Date: Wed, 15 Feb 2006 20:24:39 +0800 > From: "Luke Dunstan" <[EMAIL PROTECTED]> > Subject: Re: [PythonCE] Spinner > To: > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; format=flowed; charset="iso-8859-1"; > reply-type=original > > > This happens in GUI applications because the PythonCE shell thinks that > the > program is busy even though it may simply be in a message loop. One way to > get rid of the wait cursor is: > > import _pcceshell_support > _pcceshell_support.Busy(0) > > > Luke > > - Original Message - > From: "Jeffrey Barish" <[EMAIL PROTECTED]> > To: > Sent: Wednesday, February 15, 2006 7:42 AM > Subject: [PythonCE] Spinner > > > Does anyone know why I get the spinner over any Python application that > > I > > run? > > The application seems to be running fine even though I am supposed to > > wait for something. > > -- > > Jeffrey Barish > > ___ > > PythonCE mailing list > > PythonCE@python.org > > http://mail.python.org/mailman/listinfo/pythonce -- Jeffrey Barish ___ 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
Re: [PythonCE] Warning about comctl32.dll
- Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Wednesday, February 22, 2006 12:18 AM Subject: [PythonCE] Warning about comctl32.dll > Some of my applications are now triggering a warning when they first start > running that reads: > > Please install a newer version of comctl32.dll (at least version 4.70 is > required but you have 0.00) or the program won't operate correctly. If I search for this message on Google it appears only in wxWidgets source code, so I suggest you ask on their mailing list. Luke > > I don't have comctl32.dll anywhere I looked (such as the Windows > folder) -- > which might be why I have version 0.00. I have not detected a pattern in > which programs trigger the warning and which don't. Also, I may be > delusional but I think that programs that are generating the warning now > did > not always do so. Any thoughts? > -- > Jeffrey Barish > ___ > 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
Re: [PythonCE] Running Python program without getting Python CE window
- Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Friday, February 24, 2006 11:08 AM Subject: [PythonCE] Running Python program without getting Python CE window > Whenever I run a Python application, I get a window titled "Python CE" > that > seems to capture stdout. Is it called the console? I would like to run > my > application without getting that window. I had the impression that this > window would not appear if I ran the application using pythonw. To that > end, > I changed the first line of my application to > > #! /usr/bin/env pythonw > > (instead of /usr/bin/env/python). Changing this line has no effect in > either > CE or XP. What is the correct procedure? As somebody else mentioned, that is a Unix-specific feature. In Windows XP you can rename the file to .pyw to run it automatically with pythonw.exe. On Windows CE there is no standard way but this might help: python /nopcceshell program.py Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Unicode default encoding
- Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Friday, February 24, 2006 11:03 AM Subject: [PythonCE] Unicode default encoding > What is the correct way to set PythonCE's default Unicode encoding? My > reading (Python in a Nutshell) indicates that I am supposed to make a > change > to site.py, but there doesn't seem to be a site.py in PythonCE. (The > closest > I came is a site.pyc in python23.zip.) Nutshell suggests that in > desperation > one could put the following at the start of the main script: > > import sys > reload(sys) > sys.setdefaultencoding('iso-8859-15') > del sys.setdefaultencoding > > This code solved the problem I was having reading and processing text that > contains Unicode characters, but I am uncomfortable leaving a desperation > solution in place. > -- > Jeffrey Barish I don't think modifying site.py would be a good solution, because if you upgrade or reinstall python then the script will be overwritten. If you only want to run your program on your own system then a better solution is to create a file sitecustomize.py in your Python\Lib directory containing this: import sys sys.setdefaultencoding('iso-8859-15') If you want to distribute your program to other people though, you can't expect them to change their default encoding so it is better not to rely on the default encoding at all. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Warning about comctl32.dll
- Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Thursday, March 02, 2006 11:27 AM Subject: Re: [PythonCE] Warning about comctl32.dll >> > Some of my applications are now triggering a warning when they first >> > start >> > running that reads: >> > >> > Please install a newer version of comctl32.dll (at least version 4.70 >> > is >> > required but you have 0.00) or the program won't operate correctly. >> >> If I search for this message on Google it appears only in wxWidgets >> source >> code, so I suggest you ask on their mailing list. >> >> Luke > > I did post a message, as you suggested. In case anyone is interested, the > response that I got was: > >> It seems in 2_6_BRANCH of wxWidgets source repository this message occur >> in >> wxW/src/msw/listctrl.cpp when wxLC_VIRTUAL flag is used. > > The version of wx that runs on WinCE is 2.5.2.8u, but the symptoms match. > All > my test programs that contain a list control in virtual mode produce the > error message and those with a list control in normal mode do not. I am > still searching for a solution to this problem. > -- > Jeffrey Barish Did they admit that it is a wxWidgets bug though? As you say, Windows CE has no comctl32.dll so wxWidgets should probably not check for the version number, but I don't know for sure. The only way to avoid it would be to modify and recompile wxWidgets for WinCE. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Running Python program without getting Python CE window
The normal .py association on Windows is done with a couple of registry values: 1. Create a key: HKEY_CLASSES_ROOT\.py 2. Set the default value of this key to: Python.File 3. Create a key: HKEY_CLASSES_ROOT\Python.File\shell\open\command 4. Set the default value to: "C:\Python24\python.exe" "%1" %* Windows CE is the same but the command might be: "\Program Files\PythonCE\python.exe" "%1" You could make .pyw work on WinCE by creating a key HKCR\.pyw and another like HKCR\Python.File.NoShell, with the appropriate command line. In fact I may do this in the next version of the PythonCE installer. There are several ways to edit the registry. I've used two: 1. Total Commander, a free file manager for WinCE that includes a registry editor 2. Remote Registry Editor from MS eMbedded Visual C++ I've also used this command line console: http://www.symbolictools.de/public/pocketconsole/ Luke - Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Thursday, March 02, 2006 10:35 AM Subject: [PythonCE] Running Python program without getting Python CE window - Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Friday, February 24, 2006 11:08 AM Subject: [PythonCE] Running Python program without getting Python CE window > > Whenever I run a Python application, I get a window titled "Python CE" that > > seems to capture stdout. Is it called the console? I would like to run my > > application without getting that window. I had the impression that this > > window would not appear if I ran the application using pythonw. To that > > end, I changed the first line of my application to > > > > #! /usr/bin/env pythonw > > > > (instead of /usr/bin/env/python). Changing this line has no effect in > > either CE or XP. What is the correct procedure? > > As somebody else mentioned, that is a Unix-specific feature. In Windows XP > you can rename the file to .pyw to run it automatically with pythonw.exe. > On > Windows CE there is no standard way but this might help: > > python /nopcceshell program.py > > Luke Forgive my continued ignorance. Changing the extension works fine in XP to suppress the console window, but I don't understand how to enter the command you suggested in CE. Did you find a console for CE that permits you to type in commands? Does CE come with one (that I have been unable to locate)? I also posted a related question last week, but I never saw my message in the digest (which happens frequently). I am also wondering what the procedure is for attaching an icon to my application so that I can run the application by tapping the icon? And, to be precise, what I would like is to run my Python program in such a way that the console window does not appear. Perhaps tapping the icon would run the command that you suggested above. -- Jeffrey Barish ___ 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
Re: [PythonCE] Problem building PythonCE for x86
The problem appears to be that you added .lib files to PLATFORM_LINK32_DLL_FLAGS, and on the linker command line these appeared before the Python object files (they should be after). The fact that these lib files are not needed for the ARM build suggests that something else is wrong (I don't know what exactly). What happens without all those extra linker options you added? Luke - Original Message - From: "Ali Sabil" <[EMAIL PROTECTED]> To: Sent: Tuesday, March 14, 2006 5:15 AM Subject: [PythonCE] Problem building PythonCE for x86 > hi all, > > I tried for the last days to build python CE for a real x86 windows CE > 5.0 platform, i managed to change the makefiles, but actually it fails > linking, and complains about multiple definitions of _DllMain : > > >lib /OUT:binaries\X86Rel\pythoncore\python23_library.lib > binaries\X86Rel\pythoncore\*.obj > Microsoft (R) Library Manager Version 6.24.3077 > Copyright (C) Microsoft Corporation. All rights reserved. > >link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\nma00468. > python23_library.lib(dl_nt.obj) : error LNK2005: _DllMain already > defined in corelibc.lib(dllmain.obj) > python23_library.lib(dl_nt.obj) : warning LNK4006: _DllMain already > defined in corelibc.lib(dllmain.obj); second definit > ion ignored > Creating library binaries\X86Rel\python23.lib and object > binaries\X86Rel\python23.exp > binaries\X86Rel\python23.dll : fatal error LNK1169: one or more multiply > defined symbols found > NMAKE : fatal error U1077: 'link.exe' : return code '0x491' > Stop. > NMAKE : fatal error U1077: '"C:\Program Files\Microsoft eMbedded C++ > 4.0\COMMON\EVC\bin\NMAKE.EXE"' : return code '0x2' > Stop. > > > I edited the x86rel.mk as follow : > > PLATFORM_OUTDIR=X86Rel > PLATFORM_INTDIR=X86Rel > PLATFORM_CPP=cl.exe > PLATFORM_CPP_PROJ=/D "i486" /D "_X86_" /D "x86" /D "NDEBUG" $(CFLAGS) /D > WIN32_WCE_X86 /Gd /Oxs /LD /ML > PLATFORM_LINK32_FLAGS=/subsystem:$(CESUBSYSTEM) /MACHINE:IX86 > PLATFORM_LINK32_DLL_FLAGS=/base:"0x0010" /entry:"_DllMainCRTStartup" > coredll.lib corelibc.lib /nodefaultlib:oldnames.lib > /nodefaultlib:libc.lib $(PLATFORM_LINK32_FLAGS) > PLATFORM_RSCFLAGS=/d "_X86_" /d "x86" /d "i486" /r /d "NDEBUG" > > Thank you in advance. > > -- > Ali SABIL > > ___ > 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
Re: [PythonCE] Problem building PythonCE for x86
No, the python shell provided with PythonCE is a GUI only program so you would have to use a different shell, perhaps the default console shell that is used on desktop Windows. Luke - Original Message - From: Ali Sabil To: Luke Dunstan Sent: Wednesday, March 15, 2006 6:00 AM Subject: Re: [PythonCE] Problem building PythonCE for x86 I managed to get the dll to build using this :/defaultlib:coredll.lib /defaultlib:corelibc.lib /nodefaultlib:oldnames.lib /nodefaultlib:libc.libBut now i cannot build python.exe because of this : Microsoft (R) Program Maintenance Utility Version 6.00.8168.0Copyright (C) Microsoft Corp 1988-1998. All rights reserved.Building pythoncoreBuilding python link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\nma01216.python.obj : error LNK2019: unresolved external symbol _SipGetInfo referenced in function _PCCESHELL_Window_Threadbinaries\X86Rel\python.exe : fatal error LNK1120: 1 unresolved externalsNMAKE : fatal error U1077: 'link.exe' : return code '0x460'Stop.NMAKE : fatal error U1077: '"C:\Program Files\Microsoft eMbedded C++ 4.0\COMMON\EVC\bin\NMAKE.EXE"' : return code '0x2'Stop.I guess this is related to the fact i don't build gui support with platform builder ... what i wanted to know, is that if it was possible to build python.exe without gui support ??? As it's useless in my case thank you very much--Ali ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Using buttons on PDA
I believe the scroll button can be handled like any other keyboard event as VK_UP / VK_DOWN keys. I'm not sure about the program keys, but I think RegisterHotKey() is related. I am speaking from a WinCE API point of view so I'm not sure how this translates to wxPython. Luke - Original Message - From: "jeffbarish" <[EMAIL PROTECTED]> To: Sent: Monday, March 13, 2006 3:49 AM Subject: [PythonCE] Using buttons on PDA > > Is there a way to change the way in which the buttons on the PDA interact > with the program? I suspect that answering this question requires the > information that I am using wxPython. Currently, the scroll button will > permit me to change the selection of the current control, but I have not > found a way to tab to a different control. I would like to control one > listctrl using the button -- and only that control. It would also be nice > if I could assign useful functions to the buttons that now open the > calendar, mail, etc. > -- ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Building win32com on windows CE
The reason why is because, as far as I know, nobody has actually done the work to port win32com to WinCE and provide a makefile. If comtypes can do what you want then I would recommend trying that instead because, being written in Python, it is more portable and easier to modify and test. Luke - Original Message - From: Aladin Sidahmed To: pythonce@python.org Sent: Tuesday, March 21, 2006 3:42 AM Subject: [PythonCE] Building win32com on windows CE I was able to build both python on and windows extension packages for windows CE using the make file command of nmake all, but the build didn;'t include the COM (win32com) packages, and I am not sure why it didn't or how to do it. So I appreciate any kind of help at this moment. Thanks ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Building win32com on windows CE
What do you mean by "just a pain and led to nowhere"? I'm also not sure what you mean by a "WinCE build" of comtypes because the library is written in Python and there is nothing to "build". If you are figuring out how to use comtypes I highly recommend learning on desktop Windows first because it will be faster to develop and there are a lot more things you can do with COM than on WinCE. Luke - Original Message - From: "Aladin Sidahmed" <[EMAIL PROTECTED]> To: Sent: Wednesday, March 22, 2006 2:21 AM Subject: [PythonCE] Building win32com on windows CE > Alright, I managed to get the ctypes module installed on the winCE device, > but I can't find the source or a WinCE build for the comtypes. I tried to > use the same win32 package on Sourceforge but that was just a pain and led > to no where. > > Thanks > > Aladin > >>The reason why is because, as far as I know, nobody has actually done the > work to port win32com to WinCE and provide a makefile. If comtypes can do > what >you want then I would recommend trying that instead because, being > written in Python, it is more portable and easier to modify and test. >> >>Luke > > ___ > 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
[PythonCE] Python 2.4.3 for Windows CE / ARM
A new release of Python for Windows CE is available. Download it here: http://sourceforge.net/project/showfiles.php?group_id=104228 The release notes are linked from this page, but a direct link is: http://sourceforge.net/project/shownotes.php?release_id=407232&group_id=104228 Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python 2.4.3 for Windows CE / ARM
- Original Message - From: "Davies, Alan" <[EMAIL PROTECTED]> To: Sent: Thursday, April 06, 2006 12:18 AM Subject: Re: [PythonCE] Python 2.4.3 for Windows CE / ARM > Does this build install on WM5 Smartphone? > > --Alan If the previous version didn't work then I doubt this one will. I don't have a WM5 Smartphone though so I can't really debug and fix it. I did a search and it should be possible to build applications for Smartphone 2003 using Microsoft eMbedded Visual C++ 4.0 and then run them on WM5 Smartphone (http://www.codecomments.com/archive329-2006-3-825354.html). Have you actually tried building PythonCE for Smartphone? Luke > > -Original Message- > On 5 Apr 2006 at 20:34, Luke Dunstan wrote: > >> A new release of Python for Windows CE is available. Download it here: >> >> http://sourceforge.net/project/showfiles.php?group_id=104228 > > That's great, thanks a lot Luke! > > > > > -- > Brad Clements,[EMAIL PROTECTED](315)268-1000 > http://www.murkworks.com > AOL-IM or SKYPE: BKClements ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python 2.4.3 for Windows CE / ARM
- Original Message - From: "Jan Ischebeck" <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]>; Sent: Friday, April 07, 2006 4:46 PM Subject: Re: [PythonCE] Python 2.4.3 for Windows CE / ARM > Dear Luke, > > thanks for the great work. > > I found a small regression: > > float("2.2") > > works on win32 and linux python 2.4, but raises an error using the new > build. > > Jan It works for me: Python 2.4.3 (#0, Apr 4 2006, 23:48:52) [MSC v.1201 32 bit (Unknown)] on Pocket PC >>> float("2.2") 2.2002 What error do you get? Luke > > Luke Dunstan schrieb: >> A new release of Python for Windows CE is available. Download it here: >> >> http://sourceforge.net/project/showfiles.php?group_id=104228 >> >> The release notes are linked from this page, but a direct link is: >> >> http://sourceforge.net/project/shownotes.php?release_id=407232&group_id=104228 >> >> >> Luke >> ___ >> 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
Re: [PythonCE] Python 2.4.3 for Windows CE / ARM
Interesting. What happens if you try float("2,2")? If that works then I guess PythonCE must be using your user default locale instead of the "C" locale. It looks like this locale-based float conversion feature was added in Python 2.4 but I am guessing that on the PC the default locale is "C" unless you explicitly change it? The output of this should confirm it: import locale locale.setlocale(locale.LC_ALL) locale.localeconv() I'm not very familiar with locale programming so I'm not sure how to fix it yet. Luke - Original Message - From: <[EMAIL PROTECTED]> To: "coder_infidel" <[EMAIL PROTECTED]> Sent: Friday, April 07, 2006 9:12 PM Subject: Re: [PythonCE] Python 2.4.3 for Windows CE / ARM Dear Luke, I've the same problem of Jan: >>>float("2.2") ValueError: invalid literal for float():2.2 bye ivom italy > > - Original Message - > From: "Jan Ischebeck" <[EMAIL PROTECTED]> > To: "Luke Dunstan" <[EMAIL PROTECTED]>; > Sent: Friday, April 07, 2006 4:46 PM > Subject: Re: [PythonCE] Python 2.4.3 for Windows CE / ARM > > > > Dear Luke, > > > > thanks for the great work. > > > > I found a small regression: > > > > float("2.2") > > > > works on win32 and linux python 2.4, but raises an error using the new > > build. > > > > Jan > > It works for me: > > Python 2.4.3 (#0, Apr 4 2006, 23:48:52) [MSC v.1201 32 bit (Unknown)] on > Pocket PC > >>> float("2.2") > 2.2002 > > What error do you get? > > Luke > > > > > Luke Dunstan schrieb: > >> A new release of Python for Windows CE is available. Download it here: > >> > >> http://sourceforge.net/project/showfiles.php?group_id=104228 > >> > >> The release notes are linked from this page, but a direct link is: > >> > >> http://sourceforge.net/project/shownotes.php?release_id=407232&group_id=104228 > >> > >> > >> Luke > >> ___ > >> 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 > ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python 2.4.3 for Windows CE / ARM
- Original Message - From: "Giovanni Petrucciani" <[EMAIL PROTECTED]> To: "Jan Ischebeck" <[EMAIL PROTECTED]> Cc: Sent: Saturday, April 08, 2006 9:32 PM Subject: Re: [PythonCE] Python 2.4.3 for Windows CE / ARM > Jan Ischebeck wrote: >> Dear Luke, >> >> both float("2,2") and float("2.2") don't work. They raise an >> "ValueError: invalid literal for float(): 2.2". >> Current locale is "Deutsch" (german word for "german"). After setting >> the locale to LC_ALL it is still >> "Deutsch". >> >> According to localeconv| 'decimal_point' is "," but this should not have >> any influence on float(), >> as there is a specific locale depend function for this conversion. >> >> When I call locale.atof("2,2") I get the following error: >> Traceback(most recent call last): >> File "binaries\lib\locale.py", line 173, in atof >> ValueError: invalid literal for float():2.2 >> >> Although the locale stuff seems to be somehow mixed up, could it be that >> float("") is >> calling a locale depend wince function in python 2.4 ? >> > > I experience the same problem with an italian version of Windows CE. > > I didn't suppose float was localized (and, as it happens for you too) > float("2,2") does not work eiher > This has also bad consequences, as float() is used everywhere; for > example now you cannot load Tkinter (which does float('8.4') ...) > > IMHO float(x) shoud not use the localized version (otherwise > float(str(x)) != x even for simple x like 0.5 this is really bad) Looking at the source code for float() in floatobject.c, it calls PyOS_ascii_strtod() in pystrtod.c. This function then calls localeconv() to find the decimal point character for the current locale and if it is not '.' then the function translates any '.' in the input string to the locale decimal point. After this conversion it calls the C library strtod() function. This means that float() should work with either '.' or ',' for Italian/German locales and you can test this on the PC (as opposed to WinCE): >>> locale.setlocale(locale.LC_NUMERIC, 'Italian') 'Italian_Italy.1252' >>> float('2,2') 2.2002 >>> float('2.2') 2.2002 I tried setting my PDA to the Italian locale and I can see the problem that you describe. The bug is that Windows CE (or at least Pocket PC 2003) does not provide a setlocale() function (so of course strtod() doesn't support locales), but in the PythonCE code we are providing a fake setlocale() and localeconv() which default to returning the user default locale settings. The only solution I can see is to change localeconv() and setlocale() to always return the "C" locale settings. Do you agree? To get working locales we would need to rewrite strtod() and many other functions to take into account the current locale, so that is not really feasible. > Except for this Python 2.4 rocks, and it loads even faster. really good > job. > > (There is also one other minor addition that I would appreciate: adding > Cut/Copy/Paste on the menu near Beak/Exit/..., with the stilus it's a > log way around to get to Ctrl+C/X/V ...) Could you please submit this to the SourceForge feature request tracker so that it isn't forgotten? http://sourceforge.net/tracker/?group_id=104228&atid=637343 Luke > > I'll try to recompile it this weekend, so that I can port sqlite (and > maybe even wxPython, 4Suite and IPython) to pyce 2.4.3 > > Giovanni ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Problem calling python
- Original Message - From: "Ali Sabil" <[EMAIL PROTECTED]> To: Sent: Tuesday, April 11, 2006 2:54 AM Subject: [PythonCE] Problem calling python > Hi all, > > I have some trouble running python files. > > If i open a shell (or whatever you call it) and type: python hello.py > it starts python then says : > > Traceback(innermost last) > NULL:NULL Running python from the command prompt works for me. Did you type the full path to hello.py? If so what is the exact command you used and what was the "current directory" in the command prompt? > > If i edit the registry thingies, and associate .py with python with > something like this : > > [HKEY_CLASSES_ROOT\pyfile\Shell\Open\Command] > @="\"\\Program Files\\Python24\\python.exe\" \"%1 %2 %3 %4 %5 %6 %7 %8 > %9\"" > Try quoting the individual arguments instead of all of them as a group: @="\"\\Program Files\\Python24\\python.exe\" \"%1\" \"%2\" \"%3\" \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\"" I haven't tried it yet though... > I get the same exact effect when clicking on hello.py ... now if i use > > [HKEY_CLASSES_ROOT\pyfile\Shell\Open\Command] > @="\"\\Program Files\\Python24\\python.exe\" \"%1\"" > > It works, or at least almost, since it complains about import failure > for some modules. > The problem now is that i cannot run python from a shell, and i need > this to build a .bat that setup the environment. > > Concerning the import failure, i don't know, but it's weird since the > same code works perfectly on my linux box. What modules? Where are they located, etc? Luke > > Thank you for your help > > -- > Ali > ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Problem calling python
While you are debugging this, please be aware that unlike most operating systems, Windows CE has no concept of a "current directory" at all. The command prompt gives the illusion of a current directory for convenience but once you start another program it will have no way of knowing what the command prompt current directory was. PythonCE also emulates a current directory for compatibility with other Python platforms but it is always "\Temp" when you start PythonCE. You can see what the current (emulated) directory is using os.getcwd(). Luke - Original Message - From: "Ali Sabil" <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]> Sent: Wednesday, April 12, 2006 1:13 AM Subject: Re: [PythonCE] Problem calling python > Hi again >> >> Running python from the command prompt works for me. Did you type the >> full path to hello.py? If so what is the exact command you used and >> what was the "current directory" in the command prompt? > i didn't use a full path, hello.py was in the current directory, i > didn't try to run it with an absolute path. i'll try now and report. > > The command i used before is python hello.py , hello.py being in the cwd > >> >> Try quoting the individual arguments instead of all of them as a group: >> >> @="\"\\Program Files\\Python24\\python.exe\" \"%1\" \"%2\" \"%3\" >> \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\"" >> >> I haven't tried it yet though... > Okey i'll give it a try ... i will also try to use %* or whatever it is >> >>> I get the same exact effect when clicking on hello.py ... now if i use >>> >>> [HKEY_CLASSES_ROOT\pyfile\Shell\Open\Command] >>> @="\"\\Program Files\\Python24\\python.exe\" \"%1\"" >>> >>> It works, or at least almost, since it complains about import failure >>> for some modules. >>> The problem now is that i cannot run python from a shell, and i need >>> this to build a .bat that setup the environment. >>> >>> Concerning the import failure, i don't know, but it's weird since the >>> same code works perfectly on my linux box. >> >> What modules? Where are they located, etc? > I am trying to get xmppd (http://nuweb.org/index) to run under winCE, i > managed to build the only dependency to xmppd (which is tlslite), now i > have problems with python itself :/ (btw i built python from sources for > winCE 5.0 under an x86 platform) > > Thank you very much > > -- > Ali > ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Tkinter PhotoImage, no such file or directory
- Original Message - From: "Patrick Kramer" <[EMAIL PROTECTED]> To: Sent: Friday, April 28, 2006 3:30 PM Subject: [PythonCE] Tkinter PhotoImage, no such file or directory >I have two files which are both in the PyGlucoCE directory off of root. > > Tkintertest.py > BtnGluco.gif > > > > Here is my code: > > import sys > > sys.path.append('\\Program Files\\Python24\\python24.zip\\lib-tk') This looks OK. > sys.path.append('\\PyGlucoCE') What is the purpose of the above line? I don't think you are importing any modules from that directory. > from Tkinter import * > > root = Tk() > > ImgGlucose = PhotoImage(file = 'BtnGluco.gif') I think that should be: ImgGlucose = PhotoImage(file = '\\PyGlucoCE\\BtnGluco.gif') On the other hand, I don't know Tkinter so I may be wrong. Does Tkinter search sys.path for image files? > > print ImgGlucose.height() > > b = Button(root, image=ImgGlucose) > b.image = ImgGlucose > b.pack() > > root.mainloop() > > > > Now I get this error: > > _tkinter.TclError: couldn't open "BtnGluco.gif": no such file or directory > > > > > The weird part is I get the same error within Pydev, but if I run the > script straight through commandline, it works and shows the image as a > button. What is Pydev, and which command line are you talking about? Windows CE or Windows XP? Luke > > My guess is I screwed up the path append, but it looks correct to me :/ ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Tkinter PhotoImage, no such file or directory
- Original Message - From: "Patrick Kramer" <[EMAIL PROTECTED]> To: Sent: Saturday, April 29, 2006 10:28 AM Subject: Re: [PythonCE] Tkinter PhotoImage, no such file or directory > That worked, thanks... So is there a way to tell pythonce were the current > directory is? You can tell Python using os.chdir(), but that will not necessarily have any effect on Tkinter because the operating system has no concept of a "current directory", so it depends on whether the image file is opened in the Python code or the C code. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Tkinter PhotoImage, no such file or directory
- Original Message - From: "Michael Foord" <[EMAIL PROTECTED]> To: "Patrick Kramer" <[EMAIL PROTECTED]> Cc: Sent: Sunday, April 30, 2006 5:57 PM Subject: Re: [PythonCE] Tkinter PhotoImage, no such file or directory > Patrick Kramer wrote: >> >> >>> You can tell Python using os.chdir(), but that will not necessarily have >>> any >>> effect on Tkinter because the operating system has no concept of a >>> "current >>> directory", so it depends on whether the image file is opened in the >>> Python >>> code or the C code. >>> >>> Luke >>> >>> >> >> So there is no way for python to return the current directory it is in? >> >> say something like: >> >> dir = return_dir() >> >> image_loc = dir + "//BtnGluco.gif" >> >> Or: >> >> image_loc = dir + "//assets//img//BtnGluco.gif" #This is how I would like >> to orgnize it >> > I think the situation is (perhaps Luke can correct me if I'm wrong) : > > The underlying Windows CE platform has no concept of a current directory. > PythonCE *simulates* a current directory on the python level Correct. > This means that calls that use only Python code will work as normal - > except the current directory will always start in a fixed location > ('//Temp' I think). That is true at the moment, but in the next release I will change it so that if you run a script using the command line then the current directory will initially be set to the directory containing the script, for convenience. > Calls to use files from C code will not have access to this information. > So you can experiment with the image_loc and see if it works using the > current directory or not, but it may not do. > > To get the current directory you use the normal functions provided by > the ``os`` and ``os.path`` module : > > cur_dir = os.getcwd() > print cur_dir > os.chdir(""//assets") > print os.getcwd() Correct, except that the path separator is \ (or \\ in a string literal) not //. > image_path = os.path.join(os.getcwd(), "img//BtnGluco.gif") or continuing with that pattern: image_path = os.path.join(os.getcwd(), "img", "BtnGluco.gif") > You can also test whether you are running on windows CE or not with either > : > > sys.platform or sys.getwindowsversion() > > They should return different things on windows CE and normal windows. > That means you can make your code behave appropriately depending on > which system it is on. > > HTH > > Fuzzyman > http://www.voidspace.org.uk/python/shareware.shtml That will work, but like Gonzalo I prefer using os.name. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
[PythonCE] Python 2.4.3 for Windows CE / ARM (bug fix release)
A new bug fix release of Python for Windows CE is available. Download it here: http://sourceforge.net/project/showfiles.php?group_id=104228 The release notes are linked from this page, but a direct link is: http://sourceforge.net/project/shownotes.php?release_id=413801&group_id=104228 Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Fwd: IdleCE problem: No module named Tkconstants
- Original Message - From: "Ed Blake" <[EMAIL PROTECTED]> To: Sent: Friday, April 21, 2006 12:45 AM Subject: Re: [PythonCE] Fwd: IdleCE problem: No module named Tkconstants > > Yeah, I was going to post about what I did to get IdleCE working when I > moved > to Python 2.4, but I was lazy and didn't want to say anything stupid. > Basically paths are setup correctly on PythonCE 2.4, but none of the > Tkinter > .py files are included. Just copy everything from /lib/Tkinter on your pc > to > /lib/Tkinter on your winCE - then edit/replace Tkinter.py using the > instructions in the readme. > > At least I think that was all that was needed to get it running... Maybe > I > should fix the bugs and do a new release? Also somebody should put the > Tkinter pyc files into the zip for the next release of PythonCE, What good > is > it to include it in the path but not the distro? At first I thought so too, but actually the Tkinter .pyc files really are in the zip file, but sys.path doesn't point to them (it only points to a lib-tk directory outside the zip file). The latest release should fix this problem. Luke > > --- Roman Bischoff <[EMAIL PROTECTED]> wrote: > >> After a hard reset I lost my whole Python installation on the iPaq. >> Now I'm re-installing it, and migrating to the newer versions. >> >> ... > >> I get this error: >> >> Traceback (innermost last): >> File "\Program Files\Python24\Lib\Editor.py", line 10, in ? >> from Tkinter import * >> File "\Program Files\Python24\Lib\Tkinter.py", line 42, in ? >> from Tkconstants import * >> exceptions.ImportError: No module named Tkconstants >> >> ... >> >> Roman > > ___ > 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
Re: [PythonCE] Problem calling python
- Original Message - From: "Ed Blake" <[EMAIL PROTECTED]> To: Sent: Thursday, April 13, 2006 12:19 AM Subject: Re: [PythonCE] Problem calling python > > I've been wondering about that. Don't you get the full path to a script > when > it is run? Otherwise how would Python know where to find the file it's > supposed to execute? How can you open a file without knowing where it is? > And if you do know where a script is being run from - shouldn't that be > the > scripts initial working directory? Your suggestion has been implemented in the latest release. Luke > > --- Luke Dunstan <[EMAIL PROTECTED]> wrote: > >> >> While you are debugging this, please be aware that unlike most operating >> systems, Windows CE has no concept of a "current directory" at all. The >> command prompt gives the illusion of a current directory for convenience >> but >> once you start another program it will have no way of knowing what the >> command prompt current directory was. PythonCE also emulates a current >> directory for compatibility with other Python platforms but it is always >> "\Temp" when you start PythonCE. You can see what the current (emulated) >> directory is using os.getcwd(). >> >> Luke >> > > ___ > 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
Re: [PythonCE] webserver on CE
Can you explain more about the missing imports? If the script is designed to be portable to Windows then in most cases it should work on Windows CE. Luke - Original Message - From: Brent Pedersen To: pythonce@python.org Sent: Wednesday, May 03, 2006 2:47 AM Subject: [PythonCE] webserver on CE hi, i have a set of python CGI scripts that work on a server by serving an html form, and storing data in a text file on submission (uh, yeah, hence CGI). i'd like to get a setup so that these scripts could be used in the field (no web connection). i tried using a simple python script that acts as a webserver on the handheld GPS unit with windows CE (then access via http://localhost/), but some of the imports that the scriptServer.py (off activestate) used was missing.is there a standard FREE webserver out there for windows CE?or is there some other simple means i could use to generate a form and have input stored to a text file? i'd prefer to use html, since that's what's already used on the main server...any other ideas on storing content of an html form on submission (without web connection)?thanks,-brent ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Reverting to PythonCE 2.3
Total Commander can edit the registry on the device or Remote Registry Editor from Microsoft eMbedded Visual C++ 4.0 can do it remotely, at least on Pocket PC 2003. I think at least one of them should work on WM5. If not, you can write a Python program on the PC using the ActiveSync Remote API (RAPI) with ctypes. Luke - Original Message - From: "jeffbarish" <[EMAIL PROTECTED]> To: Sent: Friday, May 12, 2006 5:31 AM Subject: Re: [PythonCE] Reverting to PythonCE 2.3 > > Or, if no one knows how to edit the registry in Windows Mobile 5, does > anyone > know how to reload the OS? I checked at the Dell and Microsoft web sites > but found nothing. > -- ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Can't Get My Import Module Command to Work Properly
Or even easier: "The most convenient way is to add a path configuration file to a directory that's already on Python's path, usually to the .../site-packages/ directory. Path configuration files have an extension of .pth, and each line must contain a single path that will be appended to sys.path. (Because the new paths are appended to sys.path, modules in the added directories will not override standard modules. This means you can't use this mechanism for installing fixed versions of standard modules.)" (from the Python manual) For example, I have a file "sdcard.pth" in \Program Files\Python24 containing a single line: \sd-mmc Card\python Luke - Original Message - From: "Mark Doukidis" <[EMAIL PROTECTED]> To: "Bandung" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, May 17, 2006 9:15 AM Subject: Re: [PythonCE] Can't Get My Import Module Command to Work Properly > Try using "sitecustomize.py". This is the setup I used for Python2.3: > > # sitecustomize.py to be placed in python library directory. > import os > import sys > > if os.name == 'ce': > sys.path.append("\My Documents\Personal") > > Hope this is useful. > > Mark Doukidis > > On 5/17/06, Bandung <[EMAIL PROTECTED]> wrote: >> >> Using the PythonCE interactive window, I am trying to shortcut having to >> type >> in a sys.path.append() command every time I want to run a python script >> that >> is not in the standard path. So I created a module called paths.py with >> several sys.path.append commands in it. >> >> When I import this module into the interpreter, the interpreter appears >> to >> accept it with no errors. However, I can't run any python scripts that >> are >> within the new paths that my append() commands define. >> >> If I fire up a python shell interpretor and type these two commands - the >> sys.path.append() command and then type another command line like ... >> from >> "new_module" import * this works. But if I put them in a module called >> "paths" and import that module into my interpreter session, it doesn't >> work. >> Why? >> >> (1. This doesn't work) >> >>>import paths >> >> The paths.py file is sitting in the Python24\Lib directory and contains >> the >> following, >> --- >> #paths.py >> # append this path to system path >> import sys >> sys.path.append("\My Documents\Personal") >> from calctaxes import * >> No such module "calctaxes" error results. >> -- >> >> The use of any functions within calctaxes fails even though the file >> calctaxes.py sits in the directory \My Documents\Personal >> >> (2. But this works if I type the following into the interpreter... >> >> >>>import sys >> >>>sys.path.append("\My Documents\Personal") >> >>>from calctaxes import * >> >> >> Then all of my functions within calctaxes work from the interpreter. >> -- >> View this message in context: >> http://www.nabble.com/Can%27t-Get-My-Import-Module-Command-to-Work-Properly-t1631521.html#a4419614 >> Sent from the Python - pythonce forum at Nabble.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 > ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] pickle problem on 2.3.4 pythonCE (for wxPython)
Hi, Your test program works for me on PythonCE 2.4.3. Luke - Original Message - From: "Matt S." <[EMAIL PROTECTED]> To: Sent: Saturday, May 27, 2006 3:47 AM Subject: [PythonCE] pickle problem on 2.3.4 pythonCE (for wxPython) > Hi, > > I'm trying to make a data collection UI for Windows CE using the > wxPyCE distribution (which uses Python 2.3.4) found at, > > http://www.traybor.com/PythonCE/ > > It's gone well so far but I'm running into a serious data pickling > problem. Ideally I would like to pickle a class instance. > > Saving and loading the pickled class works fine on my PC (Python 2.4x), > > *pickleDump.py* > f = open('pickle_file.pyp', 'r') > pickle.dump(my_class_instance, f) > > *pickleLoad.py* > f = open('saved_pickle.pyp', 'r') > my_pickled_class_instance = pickle.load(f) > > In my UI module the pickling are methods in a class. Also, "my_class" > is actually, "another_module.top_level_class.data," wherein ".data" is > a dictionary with keys that are person names and values that are the > corresponding person instance. > > Realizing that I'm probably breaking the pickling rules with pickling > my data class, I changed "my_class" in *pickleDump.py* to a simple > dictionary... and it still failed on CE. Fortunately, simplifying my > data to a simple list does pickle. So, in the worst case I can > convert my data into lists (not pretty so if you have a better > workaround idea I'd really appreciate it). > > Here's the traceback from my attempt to load the pickled dictionary, > > Traceback (most recent call last): > File "\Program Files\python\dev\pickleLoad.py", line 10, in ? >var = pickle.load(f) > File "binaries\lib\pickle.py", line 1390, in load > File "binaries\lib\pickle.py", line 872, in load > File "binaries\lib\pickle.py", line 985, in load_string > LookupError: no codec search functions registered: can't find encoding > > Here are my test modules, > > *pickleDump.py* > > import pickle, traceback, sys > > f = open('test.txt','w') > error = open('dump_error.txt','w') > sys.stderr = error > log = open('dump_out.txt','w') > sys.stdout = log > > #var = [n for n in range(10)] > var = {'parm1':1, 'parm2':'2a'} > > try: > >pickle.dump(var,f) >print 'Pickled dumped OK in,', __file__ > except: >traceback.print_exc() >print 'Pickle dump failed! in', __file__ > > f.close() > > > *pickleLoad.py* > > import pickle, sys, traceback > > e = open('load_error.txt','w') > sys.stderr = e > s = open('load_out.txt','w') > sys.stdout = s > > try: >f = open('test.txt','r') >var = pickle.load(f) >print 'Pickle loaded OK in,', __file__ >print var > except: > >traceback.print_exc() >print 'Pickle not loaded in,', __file__ > > Many thanks for your help, > Matt ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] pickle problem on 2.3.4 pythonCE (for wxPython)
>From: "Matt S." <[EMAIL PROTECTED]> >To: "Luke Dunstan" <[EMAIL PROTECTED]> >Subject: Re: [PythonCE] pickle problem on 2.3.4 pythonCE (for wxPython) >Date: Sat, 27 May 2006 20:25:46 -0700 > >Python 2.3.4 is the only Python interpreter I've seen wxPython >compiled with for CE. Did it work for you on 2.3.4 or 2.4.3? If it >did work on 2.4.3 for you do you have wxPython running as well? >Thanks for the follow up. > >Matt Yes, 2.4.3. Sorry, I don't have wxPython running as well. You might want to try 2.3.5 but I haven't tried it so there is no guarantee that it will fix the problem. Luke > >On 5/27/06, Luke Dunstan <[EMAIL PROTECTED]> wrote: >>Hi, >> >>Your test program works for me on PythonCE 2.4.3. >> >>Luke >> >>- Original Message - >>From: "Matt S." <[EMAIL PROTECTED]> >>To: >>Sent: Saturday, May 27, 2006 3:47 AM >>Subject: [PythonCE] pickle problem on 2.3.4 pythonCE (for wxPython) >> >> >> > Hi, >> > >> > I'm trying to make a data collection UI for Windows CE using the >> > wxPyCE distribution (which uses Python 2.3.4) found at, >> > >> > http://www.traybor.com/PythonCE/ >> > >> > It's gone well so far but I'm running into a serious data pickling >> > problem. Ideally I would like to pickle a class instance. >> > >> > Saving and loading the pickled class works fine on my PC (Python 2.4x), >> > >> > *pickleDump.py* >> > f = open('pickle_file.pyp', 'r') >> > pickle.dump(my_class_instance, f) >> > >> > *pickleLoad.py* >> > f = open('saved_pickle.pyp', 'r') >> > my_pickled_class_instance = pickle.load(f) >> > >> > In my UI module the pickling are methods in a class. Also, "my_class" >> > is actually, "another_module.top_level_class.data," wherein ".data" is >> > a dictionary with keys that are person names and values that are the >> > corresponding person instance. >> > >> > Realizing that I'm probably breaking the pickling rules with pickling >> > my data class, I changed "my_class" in *pickleDump.py* to a simple >> > dictionary... and it still failed on CE. Fortunately, simplifying my >> > data to a simple list does pickle. So, in the worst case I can >> > convert my data into lists (not pretty so if you have a better >> > workaround idea I'd really appreciate it). >> > >> > Here's the traceback from my attempt to load the pickled dictionary, >> > >> > Traceback (most recent call last): >> > File "\Program Files\python\dev\pickleLoad.py", line 10, in ? >> >var = pickle.load(f) >> > File "binaries\lib\pickle.py", line 1390, in load >> > File "binaries\lib\pickle.py", line 872, in load >> > File "binaries\lib\pickle.py", line 985, in load_string >> > LookupError: no codec search functions registered: can't find encoding >> > >> > Here are my test modules, >> > >> > *pickleDump.py* >> > >> > import pickle, traceback, sys >> > >> > f = open('test.txt','w') >> > error = open('dump_error.txt','w') >> > sys.stderr = error >> > log = open('dump_out.txt','w') >> > sys.stdout = log >> > >> > #var = [n for n in range(10)] >> > var = {'parm1':1, 'parm2':'2a'} >> > >> > try: >> > >> >pickle.dump(var,f) >> >print 'Pickled dumped OK in,', __file__ >> > except: >> >traceback.print_exc() >> >print 'Pickle dump failed! in', __file__ >> > >> > f.close() >> > >> > >> > *pickleLoad.py* >> > >> > import pickle, sys, traceback >> > >> > e = open('load_error.txt','w') >> > sys.stderr = e >> > s = open('load_out.txt','w') >> > sys.stdout = s >> > >> > try: >> >f = open('test.txt','r') >> >var = pickle.load(f) >> >print 'Pickle loaded OK in,', __file__ >> >print var >> > except: >> > >> >traceback.print_exc() >> >print 'Pickle not loaded in,', __file__ >> > >> > Many thanks for your help, >> > Matt >> ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] py2exe
- Original Message - From: "Brad Clements" <[EMAIL PROTECTED]> To: Sent: Friday, June 02, 2006 7:58 AM Subject: Re: [PythonCE] py2exe > On 1 Jun 2006 at 20:59, ahmad adel rldardiry wrote: > >> Could this be done? A py2exe version for pocketpc, that generates an >> executable that can run on Pocket PC? > > py2exe requires ctypes. I think there was some progress getting ctypes to > work > on Windows CE. Actually I ported ctypes months ago, and since then both Thomas Heller and I have released ctypes binaries for versions of PythonCE. > > However you'd still need a linker for ARM and pre-made DLLs, plus figure > out if > the .zip'd python scripts can be appended to a Windows CE executable > (that's the > trick py2exe uses to bundle everything up on X86 platforms) Yes, that may be the tricky part I think, but I have not looked into it. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
[PythonCE] PythonCE wiki
Hi all, I have started a new wiki for PythonCE, because existing ones are too old and I don't have control over them as they are not hosted on SourceForge. http://pythonce.sourceforge.net/Wikka/HomePage Please note that I have written this front page initially as merely a list of *ideas* for what pages I think need to be written, but most of them are not even started yet. Feel free to write these suggested pages if you think you can, and I will try to write some too as time permits. I would like to keep the front page fairly short, so it should be refactored if it becomes too large, e.g. by moving the "getting started" links to a separate GettingStarted page. Luke Dunstan ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] PythonCE wiki
- Original Message - From: "Brad Clements" <[EMAIL PROTECTED]> To: Sent: Monday, June 19, 2006 10:51 PM Subject: Re: [PythonCE] PythonCE wiki > On 19 Jun 2006 at 10:41, Andy Baker wrote: > >> I feel it would improve things if someone could start contacting the >> authors/maintainers of some of the out of date PythonCE stuff floating >> around and ask them if they could update/remove/point to current >> stuff. > > google for "python ce" puts the oold murkworks-hosted wiki 2nd in the > results. > > How can I "share the google love" to capitalize on the old wiki moving the > new- > one up higher in the results? > > Do I just put in a link to the new site and say "go here"? I think that would help, but anyway if I was looking for Python for Windows CE I would search for 'python "windows ce"', not pythonce or "python ce", unless I already knew of the project. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] PythonCE wiki
Good idea. So far I've contacted David Kashtan and Mark Hammond to ask for links to the PythonCE project. Luke - Original Message - From: "Andy Baker" <[EMAIL PROTECTED]> To: Sent: Monday, June 19, 2006 5:41 PM Subject: Re: [PythonCE] PythonCE wiki I feel it would improve things if someone could start contacting the authors/maintainers of some of the out of date PythonCE stuff floating around and ask them if they could update/remove/point to current stuff. The first impressions you get when you google for PythonCE is that it is a project that isn't particularly current. It would be nice to try and get the main google hits looking a bit more loved. On 6/17/06, Gonzalo Monzón <[EMAIL PROTECTED]> wrote: > Good idea Luke!! > > Cheers, > Gonzalo > > Luke Dunstan escribió: > > >Hi all, > > > >I have started a new wiki for PythonCE, because existing ones are too old > >and I don't have control over them as they are not hosted on SourceForge. > > > >http://pythonce.sourceforge.net/Wikka/HomePage > > > >Please note that I have written this front page initially as merely a > >list > >of *ideas* for what pages I think need to be written, but most of them > >are > >not even started yet. Feel free to write these suggested pages if you > >think > >you can, and I will try to write some too as time permits. I would like > >to > >keep the front page fairly short, so it should be refactored if it > >becomes > >too large, e.g. by moving the "getting started" links to a separate > >GettingStarted page. > > > >Luke Dunstan > >___ > >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 > -- -- http://www.andybak.net ___ 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
Re: [PythonCE] serial port access
You need to use the wide-character variants of Windows APIs, i.e. CreateFileW Luke - Original Message - From: "Benjamin McBride" <[EMAIL PROTECTED]> To: Sent: Wednesday, June 21, 2006 4:54 AM Subject: Re: [PythonCE] serial port access Thanks Gonzalo for your help. I have read both the ctypes and microsoft documentation. My understanding is that I need to use the CreateFile API function from the coredll to get a handle to the comm port. When I use ctypes: >>> windll.coredll.CreateFile I get an AttributeError saying the CreateFile function is not found. Ironically, the ReadFile, WriteFile, and CloseHandle functions are all found. Am I just missing something simple here? Ben On 6/20/06, Gonzalo Monzón <[EMAIL PROTECTED]> wrote: > Have you read the ctypes docs? > > http://starship.python.net/crew/theller/ctypes/tutorial.html > > You have to read the Microsoft docs too, search what dynamic libraries > to use and what functions to call. Study the example I posted, you have > to call these functions using ctypes: > > (openfile, readfile, writefile...) > > Don't know if somebody has implemented serial access using ctypes as to > post an example, read the docs, first you need to understand how ctypes > work -for that you should know or learn what C variable types are and > understand it almost a little bit, then the codeproject example will > come in handy- otherwise could be hard to code... Though any ctypes > example handling file or stream data may help you. Though pyserial uses > ctypes too, so you could have a look to the sources. The differences are > you have to use straight windows api calls, and pyserial calls a helper > library wich should use windows api's for windows platform. > > I have to code serial access too in the next weeks, but don't have the > time now to get my hands in it. If you are not in hurry I could post an > example when done. > > Gonzalo. > > > Benjamin McBride escribió: > > >I've got ctypes installed. However, I have not been able to find any > >examples of how I might use ctypes for serial port access. Any > >suggestions would be appreciated. > > > >Thanks, > > > >Ben > > > >On 6/20/06, Gonzalo Monzón <[EMAIL PROTECTED]> wrote: > > > > > >>Hi Benjamin, > >> > >>You can use ctypes for direct access to serial ports via windows apis > >>(openfile, readfile, writefile...) > >> > >>Note that manufacturers can have specific implementations, even they > >>must agree to PPC implementation, but you can found small differences. > >> > >>http://www.codeproject.com/system/simpleserialcomm.asp > >> > >>Regards, > >>Gonzalo > >> > >> > >>Benjamin McBride escribió: > >> > >> > >> > >>>Hi All, > >>> > >>>I need to access the serial port for my PPC application. I have > >>> been > >>>unable to locate information on this. I'm using Python 2.4.3 and > >>> PPC > >>>2003. Previously I've used pyserial, but it appears that pyserial > >>> does > >>>not work on Windows CE. > >>> > >>>Thanks for any suggestions, > >>> > >>>Ben McBride > >>>[EMAIL PROTECTED] > >>>___ > >>>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 > > > > > > > > ___ 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
Re: [PythonCE] building a 'simple' example
Hi, Where did you put the DLL? What is it called? What were the commands that failed? Luke - Original Message - From: "Smit, M.C." <[EMAIL PROTECTED]> To: Sent: Friday, June 23, 2006 11:21 PM Subject: [PythonCE] building a 'simple' example > Dear all > > While there have been some posts on this topic I don't believe the answer > is in there jet. > > Eventually I want to write (with help of a colliegue whom is experienced > in c) a module that can use a device. Some c libraries are available, and > all I realy need is a function that returns an Int or String when called. > > I am trying to to build and run Listing 29-1 from the Python bible, > but so far I have been unable to compile annything that will work. > MS eVC is installed, and it compiles and links with no errors or warnings. > but when I put the dll on the PDA, and run a test program all I get is an > > ImportError: DLL load failed:The specified module could not be found. > > it can clearly find the file couse it knows it is a dll. I'm hoplessly > lost on what could be wrong, does annyone have any ideas. > > Cheers > > > here is the code: > // simple.cpp : Defines the entry point for the DLL application. > // > > #include "Python.h" > > static PyObject *simple_add(PyObject *pSelf, PyObject *pArgs) > { > PyObject *pX, *pY; > > if (!PyArg_ParseTuple(pArgs, "OO", &pX, &pY)) > return NULL; > > return PyNumber_Add(pX, pY); > } > > static char count_doc[] = "returns the number of arguments passed in"; > > static PyObject *simple_count(PyObject *pSelf, PyObject *pArgs) > { > long count = PyTuple_Size(pArgs); > return PyInt_FromLong(count); > } > > static PyMethodDef simple_methods[] = > { > {"add", simple_add, METH_VARARGS, NULL}, > {"count", simple_count, METH_VARARGS, count_doc}, > {NULL, NULL} > }; > > DL_EXPORT(void) initsimple() > { > Py_InitModule("simple", simple_methods); > } ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Problem with ctypes
- Original Message - From: "Tod Haren" <[EMAIL PROTECTED]> To: Sent: Saturday, June 24, 2006 11:07 AM Subject: [PythonCE] Problem with ctypes > The wince files on the ctypes sourceforge project site don't work for > me. import ctypes was resulting in "import error: dll load failed". > I claimed to be unable to locate _ctypes.pyd even though it was > present and in sys.path. I tried both 0.9.9.6 and 0.9.9.3 with no > luck, I tried different paths and configurations too. What was the name of the file you downloaded from the ctypes project? Are you sure it wasn't for Python 2.3? Luke > > I finally checked the the pythonce project and downloaded the 0.9.9.6 > files from there. They worked like a charm and now I'm up and running > ctypes again. > > I have Python 2.4.3 running on a Dell Axim X5 with PPC 2003, installed > to the SD Card. > > Has anyone else had similar problems? > > Tod ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] building a 'simple' example
Hi, I think the only way I could help further is if you posted a small but complete example that demonstrates the problem. Luke - Original Message - From: "Smit, M.C." <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]>; Sent: Monday, June 26, 2006 3:40 PM Subject: RE: [PythonCE] building a 'simple' example Hi The path is in sys.path. The DLL is next to the test programme that tries to import it, it name is simple.dll, andthe error is raised on: import simple ImportError: DLL load failed:The specified module could not be found. I'm running an winXP computer and an Ipac PDA winMobile 2003 thanks for your thoughts -Original Message- From: [EMAIL PROTECTED] on behalf of Luke Dunstan Sent: Fri 6/23/2006 6:04 PM To: pythonce@python.org Cc: Subject: Re: [PythonCE] building a 'simple' example Hi, Where did you put the DLL? What is it called? What were the commands that failed? Luke - Original Message - From: "Smit, M.C." <[EMAIL PROTECTED]> To: Sent: Friday, June 23, 2006 11:21 PM Subject: [PythonCE] building a 'simple' example > Dear all > > While there have been some posts on this topic I don't believe the answer > is in there jet. > > Eventually I want to write (with help of a colliegue whom is experienced > in c) a module that can use a device. Some c libraries are available, and > all I realy need is a function that returns an Int or String when called. > > I am trying to to build and run Listing 29-1 from the Python bible, > but so far I have been unable to compile annything that will work. > MS eVC is installed, and it compiles and links with no errors or warnings. > but when I put the dll on the PDA, and run a test program all I get is an > > ImportError: DLL load failed:The specified module could not be found. > > it can clearly find the file couse it knows it is a dll. I'm hoplessly > lost on what could be wrong, does annyone have any ideas. > > Cheers > > > here is the code: > // simple.cpp : Defines the entry point for the DLL application. > // > > #include "Python.h" > > static PyObject *simple_add(PyObject *pSelf, PyObject *pArgs) > { > PyObject *pX, *pY; > > if (!PyArg_ParseTuple(pArgs, "OO", &pX, &pY)) > return NULL; > > return PyNumber_Add(pX, pY); > } > > static char count_doc[] = "returns the number of arguments passed in"; > > static PyObject *simple_count(PyObject *pSelf, PyObject *pArgs) > { > long count = PyTuple_Size(pArgs); > return PyInt_FromLong(count); > } > > static PyMethodDef simple_methods[] = > { > {"add", simple_add, METH_VARARGS, NULL}, > {"count", simple_count, METH_VARARGS, count_doc}, > {NULL, NULL} > }; > > DL_EXPORT(void) initsimple() > { > Py_InitModule("simple", simple_methods); > } ___ 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
Re: [PythonCE] Command line
Hi, Yes, you can run Python scripts by passing them on the command line to python.exe. This is what happens when you double-click a script. Are you having trouble in some way? Luke - Original Message - From: ahmad adel rldardiry To: PythonCE@python.org Sent: Sunday, June 25, 2006 7:00 PM Subject: [PythonCE] Command line السلام عليكم ورحمة الله وبركاتهMay peace and Allah Mercy and Blessings be upon you, Can I execute a .py as a commandline parameter to pythonce, giving that python is installed on the device? eg. start python.exe t.py (-hidden?) Thanks لا إله إلا اللهThere is no god but Allah أحمدAhmadhttp://www.shagarah.comhttp://www.newhive.com ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Command line
Hi, You will need to pass the script name as an absolute path. See also: http://pythonce.sourceforge.net/Wikka/UsingPythonCE Luke - Original Message - From: ahmad adel rldardiry To: Luke Dunstan Sent: Wednesday, June 28, 2006 8:09 PM Subject: Re: [PythonCE] Command line السلام عليكم ورحمة الله وبركاتهMay peace and Allah Mercy and Blessings be upon you, Thanks for replying, I thought nobody will! Yes I have tested it in the CMD (www.symbolictools.de) like this: cd program files\python24\ start python.exe t.py in t.py: f=file('pp.txt','w') f.write('Besmellah') f.close() it gaves this error: Traceback (innermost last): : Also I want to be able to hide the file (hidden startup) is this possible? Thanks لا إله إلا اللهThere is no god but Allah أحمدAhmadhttp://www.shagarah.comhttp://www.newhive.com - Original Message - From: Luke Dunstan To: pythonce@python.org Sent: Wednesday, June 28, 2006 2:51 PM Subject: Re: [PythonCE] Command line Hi, Yes, you can run Python scripts by passing them on the command line to python.exe. This is what happens when you double-click a script. Are you having trouble in some way? Luke - Original Message - From: ahmad adel rldardiry To: PythonCE@python.org Sent: Sunday, June 25, 2006 7:00 PM Subject: [PythonCE] Command line السلام عليكم ورحمة الله وبركاتهMay peace and Allah Mercy and Blessings be upon you, Can I execute a .py as a commandline parameter to pythonce, giving that python is installed on the device? eg. start python.exe t.py (-hidden?) Thanks لا إله إلا اللهThere is no god but Allah أحمدAhmadhttp://www.shagarah.comhttp://www.newhive.com ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Command line
It should work with spaces if you quote it properly (this is true of any operating system), e.g. python "\my documents\python\test.py" Luke - Original Message - From: ahmad adel rldardiry To: Luke Dunstan Sent: Thursday, June 29, 2006 1:48 AM Subject: Re: [PythonCE] Command line السلام عليكم ورحمة الله وبركاتهMay peace and Allah Mercy and Blessings be upon you, Thanks a lot Luke. After some tests, it worked fine, also with the "/nopcceshell" flag (very cool). It seems that python does not accept paths with spaces though: python.exe \Program Files\ .. So now, if I wanted to distribute pythonce with a software I made (for using as command line) what license should I include or even do I have the right to? Thanks again. لا إله إلا اللهThere is no god but Allah أحمدAhmadhttp://www.shagarah.comhttp://www.newhive.com - Original Message ----- From: Luke Dunstan To: pythonce@python.org Sent: Wednesday, June 28, 2006 4:36 PM Subject: Re: [PythonCE] Command line Hi, You will need to pass the script name as an absolute path. See also: http://pythonce.sourceforge.net/Wikka/UsingPythonCE Luke - Original Message - From: ahmad adel rldardiry To: Luke Dunstan Sent: Wednesday, June 28, 2006 8:09 PM Subject: Re: [PythonCE] Command line السلام عليكم ورحمة الله وبركاتهMay peace and Allah Mercy and Blessings be upon you, Thanks for replying, I thought nobody will! Yes I have tested it in the CMD (www.symbolictools.de) like this: cd program files\python24\ start python.exe t.py in t.py: f=file('pp.txt','w') f.write('Besmellah') f.close() it gaves this error: Traceback (innermost last): : Also I want to be able to hide the file (hidden startup) is this possible? Thanks لا إله إلا اللهThere is no god but Allah أحمدAhmadhttp://www.shagarah.comhttp://www.newhive.com ----- Original Message - From: Luke Dunstan To: pythonce@python.org Sent: Wednesday, June 28, 2006 2:51 PM Subject: Re: [PythonCE] Command line Hi, Yes, you can run Python scripts by passing them on the command line to python.exe. This is what happens when you double-click a script. Are you having trouble in some way? Luke - Original Message - From: ahmad adel rldardiry To: PythonCE@python.org Sent: Sunday, June 25, 2006 7:00 PM Subject: [PythonCE] Command line السلام عليكم ورحمة الله وبركاتهMay peace and Allah Mercy and Blessings be upon you, Can I execute a .py as a commandline parameter to pythonce, giving that python is installed on the device? eg. start python.exe t.py (-hidden?) Thanks لا إله إلا اللهThere is no god but Allah أحمدAhmadhttp://www.shagarah.comhttp://www.newhive.com ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Problem with ctypes
It does say so in the release notes linked from the SourceForge files page: http://sourceforge.net/project/shownotes.php?release_id=411554&group_id=71702 Luke - Original Message - From: "Tod Haren" <[EMAIL PROTECTED]> To: Sent: Wednesday, June 28, 2006 10:19 PM Subject: Re: [PythonCE] Problem with ctypes >I concur with Craig. There was no explicit indication what > python version the ctypes wince release was for. At least not an > indication that I found. > ___ > 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
Re: [PythonCE] building a 'simple' example
Hi, I built your example simple.pyd and the only problem was that at first Python reported the error: Error: dynamic module does not define init function (initsimple) The solution was to declare it properly by adding extern "C": extern "C" DL_EXPORT(void) initsimple() This may not be related to your problem though. Anyway, after this change it worked fine. Please post more information about how you built the DLL (e.g. the project files), what SDK you used, and how you configured it to use the Python headers and libraries. Luke - Original Message - From: "Smit, M.C." <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]> Sent: Monday, July 03, 2006 9:26 PM Subject: RE: [PythonCE] building a 'simple' example Hi, Thanks for saying with me, The "simple" example is at the bottom of the thread(and this mail). The .py program that calls it is: import simple but ceaches with: ImportError: DLL load failed:The specified module could not be found. I would feel very foolish, but if I need more than that, than I am totally unawhare of it. I must admit I am a bit out of my league here. Thanks for your toughts. >Hi, > >I think the only way I could help further is if you posted a small but >complete example that demonstrates the problem. > >Luke > >- Original Message - >From: "Smit, M.C." >To: "Luke Dunstan" ; >Sent: Monday, June 26, 2006 3:40 PM >Subject: RE: [PythonCE] building a 'simple' example > > >Hi > >The path is in sys.path. The DLL is next to the test programme that tries >to >import it, it name is simple.dll, andthe error is raised on: import simple > >ImportError: DLL load failed:The specified module could not be found. > >I'm running an winXP computer >and an Ipac PDA winMobile 2003 > >thanks for your thoughts > > > >-Original Message- >From: pythonce-bounces at python.org on behalf of Luke Dunstan >Sent: Fri 6/23/2006 6:04 PM >To: pythonce at python.org >Cc: >Subject: Re: [PythonCE] building a 'simple' example > > >Hi, > >Where did you put the DLL? What is it called? What were the commands that >failed? > >Luke > >- Original Message - >From: "Smit, M.C." >To: >Sent: Friday, June 23, 2006 11:21 PM >Subject: [PythonCE] building a 'simple' example > > Dear all > > While there have been some posts on this topic I don't believe the answer > is in there jet. > > Eventually I want to write (with help of a colliegue whom is experienced > in c) a module that can use a device. Some c libraries are available, and > all I realy need is a function that returns an Int or String when called. > > I am trying to to build and run Listing 29-1 from the Python bible, > but so far I have been unable to compile annything that will work. > MS eVC is installed, and it compiles and links with no errors or warnings. > but when I put the dll on the PDA, and run a test program all I get is an > > ImportError: DLL load failed:The specified module could not be found. > > it can clearly find the file couse it knows it is a dll. I'm hoplessly > lost on what could be wrong, does annyone have any ideas. > > Cheers > > > here is the code: > // simple.cpp : Defines the entry point for the DLL application. > // > > #include "Python.h" > > static PyObject *simple_add(PyObject *pSelf, PyObject *pArgs) > { > PyObject *pX, *pY; > > if (!PyArg_ParseTuple(pArgs, "OO", &pX, &pY)) > return NULL; > > return PyNumber_Add(pX, pY); > } > > static char count_doc[] = "returns the number of arguments passed in"; > > static PyObject *simple_count(PyObject *pSelf, PyObject *pArgs) > { > long count = PyTuple_Size(pArgs); > return PyInt_FromLong(count); > } > > static PyMethodDef simple_methods[] = > { > {"add", simple_add, METH_VARARGS, NULL}, > {"count", simple_count, METH_VARARGS, count_doc}, > {NULL, NULL} > }; > > DL_EXPORT(void) initsimple() > { > Py_InitModule("simple", simple_methods); > } ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Edit WinCE registry from desktop
- Original Message - From: "Tod Haren" <[EMAIL PROTECTED]> To: Sent: Friday, July 14, 2006 3:29 PM Subject: [PythonCE] Edit WinCE registry from desktop > I've been using the pocketRapi scripts submitted previously by helpful > TechGame folks, their names escape me right now. So far it suits my > needs and seems to work great. However it doesn't implement all of > the rapi.dll functions. I'd like to be able to read/write to the > registry on the PPC from Python on the desktop. Does anyone know how > I can do this? Are there other modules or scripts available as > examples that somebody could share? Any tips would be appreciated. > > Tod If you want to do it from Python, just use the remote registry APIs in rapi.dll (as documented on MSDN) with ctypes. Otherwise, Microsoft eMbedded Visual C++ 4.0 includes a Remote Registry Editor. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] File association image for .py
- Original Message - From: "Alex Mandel" <[EMAIL PROTECTED]> To: Sent: Friday, July 21, 2006 5:13 AM Subject: [PythonCE] File association image for .py >I know it's a little trivial but it's the kind of thing that end users > really like. Anyone know how to add a registry entry so the .py files > get a nice python icon in the File Explorer. Create a registry key: HKEY_CLASSES_ROOT\Python.File\DefaultIcon Set the default value of this key to: \Program Files\Python24\python.exe,0 > I'm assuming that it can be done in the PythonCE.inf for the CAB but I > don't know the syntax. If someone knows how, I think it should be added > to the next release. Yes, it will be in the next release. Luke > Thanks, > Alex ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] File association image for .py
- Original Message - From: "Anne Wangnick" <[EMAIL PROTECTED]> To: Cc: "Luke Dunstan" <[EMAIL PROTECTED]> Sent: Thursday, July 27, 2006 4:02 AM Subject: AW: [PythonCE] File association image for .py > Hello Luke, > > watch out. In foreign versions of Windows CE the folder might be called > something else than "Program Files". E.g., in the German version it's > called > "Programme". I'm quite sure though that the name of the folder can be > found > in the registry under a generic path. > > Regards, > Sebastian Wangnick Yes, this is already handled by the CAB file installer, because the .inf file contains: InstallDir = %CE1%\%AppName% Luke > > -----Ursprungliche Nachricht- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Auftrag von Luke Dunstan > Gesendet: Montag, 24. Juli 2006 17:01 > An: pythonce@python.org; Alex Mandel > Betreff: Re: [PythonCE] File association image for .py > > > > - Original Message - > From: "Alex Mandel" <[EMAIL PROTECTED]> > To: > Sent: Friday, July 21, 2006 5:13 AM > Subject: [PythonCE] File association image for .py > > >>I know it's a little trivial but it's the kind of thing that end users >> really like. Anyone know how to add a registry entry so the .py files >> get a nice python icon in the File Explorer. > > Create a registry key: HKEY_CLASSES_ROOT\Python.File\DefaultIcon > Set the default value of this key to: \Program Files\Python24\python.exe,0 > >> I'm assuming that it can be done in the PythonCE.inf for the CAB but I >> don't know the syntax. If someone knows how, I think it should be added >> to the next release. > > Yes, it will be in the next release. > > Luke > >> Thanks, >> Alex ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python 2.5?
Hi, Yes I have done some work on porting Python 2.5 but it is not yet complete enough to be useful, so I will let you know how it goes. Luke - Original Message - From: Yi Ding To: pythonce@python.org Sent: Saturday, July 29, 2006 4:15 AM Subject: [PythonCE] Python 2.5? Hi,I was wondering if there was any ongoing work on some patches for Python 2.5? I know it's still in beta, but I'd be happy to help out coding or testing if someone is working on it.Thanks,Yi ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] SimpleHTTPServer
- Original Message - From: "Belyaev Dmitry" <[EMAIL PROTECTED]> To: Sent: Tuesday, August 01, 2006 2:40 AM Subject: [PythonCE] SimpleHTTPServer >I tried to write simple http server on my PDA. > -- > import SimpleHTTPServer as Handler > import BaseHTTPServer as Server > > h = Handler.SimpleHTTPRequestHandler > s = Server.HTTPServer(('localhost', 80), h) > s.serve_forever() The above works fine for me on Pocket PC 2003 with PythonCE 2.4.3. Is your OS or Python version different? I did use Pocket Internet Explorer. Luke > -- > It works on Desktop, but failes on PDA with the following error: > -- > Exception happened during processing of request from ('127.0.0.1', 1026) > Traceback (most recent call last): > File "binaries\lib\SocketServer.py", line 222, in handle_request > File "binaries\lib\SocketServer.py", line 241, in process_request > File "binaries\lib\SocketServer.py", line 254, in finish_request > File "binaries\lib\SocketServer.py", line 521, in __init__ > File "binaries\lib\BaseHTTPServer.py", line 316, in handle > File "binaries\lib\BaseHTTPServer.py", line 299, in handle_one_request > File "binaries\lib\socket.py", line 340, in readline > error: (10054, 'Connection reset by peer') > -- > Is it error in Internet Explorer CE or in PythonCE? ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] SimpleHTTPServer
Does it make a difference if you use http://127.0.0.1/ ? localhost has never worked for me on Windows CE, regardless of whether the server is implemented in Python or C++. Luke - Original Message - From: "Belyaev Dmitry" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; Sent: Thursday, August 03, 2006 1:57 AM Subject: Re[2]: [PythonCE] SimpleHTTPServer > Hello, Luke Dunstan > > I'm using > Python 2.4.3 (#0, Apr 29 2006, 20:58:35)[MSC v.1201 32bit (Unknown)] on > Pocket PC > on iPAQ hx2110, Windows Mobile 2003 Second Edition, Version 4.21.1088 > (Build 14132) > > When I type "http://localhost/"; and tap "Go" request come Python, but a > bit later Connectivity window popup, and it says that PDA is not connected > to Internet. > > I'm going to try Opera for PocketPC, maybe it will help. > > Wed, 02.08.2006 17:03:18 you wrote: > > LD> > LD> - Original Message - > LD> From: "Belyaev Dmitry" <[EMAIL PROTECTED]> > LD> To: > LD> Sent: Tuesday, August 01, 2006 2:40 AM > LD> Subject: [PythonCE] SimpleHTTPServer > LD> > LD> > LD> >I tried to write simple http server on my PDA. > LD> > -- > LD> > import SimpleHTTPServer as Handler > LD> > import BaseHTTPServer as Server > LD> > > LD> > h = Handler.SimpleHTTPRequestHandler > LD> > s = Server.HTTPServer(('localhost', 80), h) > LD> > s.serve_forever() > LD> > LD> The above works fine for me on Pocket PC 2003 with PythonCE 2.4.3. Is > your > LD> OS or Python version different? I did use Pocket Internet Explorer. > LD> > LD> Luke > LD> > LD> > -- > LD> > It works on Desktop, but failes on PDA with the following error: > LD> > -- > LD> > Exception happened during processing of request from ('127.0.0.1', > 1026) > LD> > Traceback (most recent call last): > LD> > File "binaries\lib\SocketServer.py", line 222, in handle_request > LD> > File "binaries\lib\SocketServer.py", line 241, in process_request > LD> > File "binaries\lib\SocketServer.py", line 254, in finish_request > LD> > File "binaries\lib\SocketServer.py", line 521, in __init__ > LD> > File "binaries\lib\BaseHTTPServer.py", line 316, in handle > LD> > File "binaries\lib\BaseHTTPServer.py", line 299, in > handle_one_request > LD> > File "binaries\lib\socket.py", line 340, in readline > LD> > error: (10054, 'Connection reset by peer') > LD> > -- > LD> > Is it error in Internet Explorer CE or in PythonCE? > > Belyaev Dmitry > ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Sending files across 2 PDA connected in wifi(ad-hoc mode)
PythonCE supports sockets so yes, it is possible to transfer data over a wireless LAN just like any other TCP/IP network. No I haven't tried with two PDAs. If you are searching for source code then try looking for Python sockets code in general, and test your code on a Windows PC first with local sockets. Have a look at the "socket" module. Luke - Original Message - From: Francois Bonnet To: pythonce@python.org Sent: Tuesday, August 08, 2006 7:19 AM Subject: [PythonCE] Sending files across 2 PDA connected in wifi(ad-hoc mode) Hi,I would like to code a soft to send files between 2 PDA (Arm based devices) connected in ad-hoc mode. (using wifi) and I can't file any source code for this.Is it possible with PytonCE ?Have you ever try?Thanks for your help!RegardsFrancois ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Starting Python in specified directory
- Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Monday, September 25, 2006 10:43 PM Subject: Re: [PythonCE] Starting Python in specified directory > Ingmar Steen wrote: > >> You could create a small dummy script in that path that >> just contains 'pass' and starting that using the python interpreter with >> the -i option (make a shortcut 'python -i "\My >> Documents\myprog\dummy.py"'). > > How do I create the shortcut in WM? > > Is there something like .pythonrc in WM that gets read everytime python > starts? > -- > Jeffrey Barish Yes, "pythonrc.py". It is only run for interactive sessions, not when you double-click on a .py file, but that sounds like what you want. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Trying to Code Python ON a Pocket PC Phone
- Original Message - From: "Bandung" <[EMAIL PROTECTED]> To: Sent: Wednesday, September 27, 2006 2:35 AM Subject: Re: [PythonCE] Trying to Code Python ON a Pocket PC Phone > I > wish there was a "path" equivalent for Windows mobile so that I could put > \Storage Card\Program Files\Python24 in the path statement and just type > :!start python.exe Have you tried this?: :!start "\Storage Card\Program Files\Python24\python.exe" (I haven't) Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Starting Python in specified directory
- Original Message - From: "Jeffrey Barish" <[EMAIL PROTECTED]> To: Sent: Tuesday, September 26, 2006 12:06 AM Subject: Re: [PythonCE] Starting Python in specified directory > Luke Dunstan wrote: > >> Yes, "pythonrc.py". It is only run for interactive sessions, not when you >> double-click on a .py file, but that sounds like what you want. > > Yes, that is what I want. Where do I put pythonrc.py? I tried putting it > in \Program Files\Python24 and its Lib and DLLs subfolders, but it isn't > read automatically in any of those cases. > -- > Jeffrey Barish Hmm, good point. It is currently looking in \Temp which is not ideal. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] call scrypt with parameters
Title: Mensaje Please show the exact code where you call this "RunApp". Luke - Original Message - From: Fredy Cabre To: pythonce@python.org Sent: Monday, October 09, 2006 6:00 AM Subject: [PythonCE] call scrypt with parameters the problem that I wrote in the previous e-mail is solved with reset of the ppc. :-) But now I have another problem. I make a little aplication with a program (Sprint DB) that allow to send another program with a method named 'RunApp', well, I call my scrypt with this metod that have 2 parameters: Application and Parameters. I put the path of the scrypt in the Aplicattion parameter and the scrypt's parameters in the Parameters parameter, but when i call the method give this error: path_origen=sys.argv[1] 'list index out of range' That mains that the scrypt don't detect the parameters that i send. What can I do to send the scrypt's arguments correctly? Thank you. ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Error
Which version of PythonCE did you try? All the recent releases are built for Pocket PC 2003 (Windows CE 4.2). Luke - Original Message - From: Brutal To: pythonce@python.org Sent: Wednesday, October 11, 2006 8:13 AM Subject: [PythonCE] Error I get invalid windows CE application upon running it any ideas? (im running a jornada 540 series with windows CE Version 3.0.9348 (build 9357))Thanks,Brutal ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Error
Hi, I don't know for sure because I haven't tried it with WinCE 3.0, but on the Files page it looks like one of these would work: http://prdownloads.sourceforge.net/pythonce/Python-2.3.4-arm-PPC2002.zip?download http://prdownloads.sourceforge.net/pythonce/python-2.3.4-arm-HPC2000.zip?download Luke - Original Message - From: Brutal To: Luke Dunstan Sent: Wednesday, October 11, 2006 9:55 AM Subject: Re: [PythonCE] Error Ok Thanks For the Help but can you point me in the best version that will work with my version? (3) - Original Message - From: Luke Dunstan To: Brutal Cc: pythonce@python.org Sent: Tuesday, October 10, 2006 8:27 PM Subject: Re: [PythonCE] Error Which version of PythonCE did you try? All the recent releases are built for Pocket PC 2003 (Windows CE 4.2). Luke - Original Message - From: Brutal To: pythonce@python.org Sent: Wednesday, October 11, 2006 8:13 AM Subject: [PythonCE] Error I get invalid windows CE application upon running it any ideas? (im running a jornada 540 series with windows CE Version 3.0.9348 (build 9357))Thanks,Brutal ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] call scrypt with parameters
Title: Mensaje In that case, it depends on how RunApp() is implemented. If it calls ShellExecuteEx() then I think it is not possible to pass parameters. Try this: RunApp('\Program Files\python24\python.exe', '\mover_fotos.py \ - -') Luke - Original Message - From: Fredy Cabre To: pythonce@python.org Sent: Wednesday, October 11, 2006 4:49 AM Subject: [PythonCE] call scrypt with parameters This is the call to the scrypt wich have 3 parameters: RunApp('\mover_fotos.py','\ - -')--- This is the beginning of the scrypt: # -*- coding: cp1252 -*- import glob, shutil import os import sys i=0 ruta_Origen=sys.argv[1] ruta_Desti=sys.argv[2] nom_Fich=sys.argv[3]- the error that give me: ruta_origen=sys.argv[1] exceptions.Indexerror: list index out of range. ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
[PythonCE] Python 2.5 for Windows CE / ARM
A new release of Python for Windows CE is available. Download it here: http://sourceforge.net/project/showfiles.php?group_id=104228 The release notes are linked from this page, but a direct link is: http://sourceforge.net/project/shownotes.php?release_id=454685&group_id=104228 Please consider this release to be a Beta because it has not been tested thoroughly enough on Windows CE to be considered stable. I think that the most efficient way to continue testing will be for everyone to try it and report any bugs. Luke Dunstan ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python 2.5 for Windows CE / ARM
- Original Message - From: "Bandung" <[EMAIL PROTECTED]> To: Sent: Thursday, October 12, 2006 12:09 PM Subject: Re: [PythonCE] Python 2.5 for Windows CE / ARM > > I tried running a simple app that uses Tkinter but I get the error message > _tkinter not found. > > Traceback (most recent call last): > File "\Storage > Card\5_software_developed\testcode\GstApps\gui_class\input.py", line 2, in > >from Tkinter import * > File > "C:\devl\release\PythonCE-2.5-20061012\Python-2.5-wince\Lib\lib-tk\Tkinter.py", > line 38, in > ImportError: No module named _tkinter I think this is because DLLs\_tkinter.pyd doesn't exist, not because sys.path is wrong. Do you agree? I will try to add it back in the next release and/or as a separate package. > > Can you compile the binaries with the typical /Storage card/Program > Files/Python25/ path so that we don't have to evoke work arounds in > order use these modules? If PythonCE is installed in "\Storage Card\Program Files\Python25" then it should work. > I really appreciate the gui popup that you implemented when raw_input is > used. Thanks should go to the person who contributed it :-) > Also, import dbapi2 isn't recognized as a legitimate command (possibly due > to the current default paths) I think this is because the release doesn't include pySQLite yet. > Will the durus persistence modules be eventually added with this release. What is it? Is it a part of the standard library? Luke > > > > Luke Dunstan wrote: >> >> A new release of Python for Windows CE is available. Download it here: >> >> http://sourceforge.net/project/showfiles.php?group_id=104228 >> >> The release notes are linked from this page, but a direct link is: >> >> http://sourceforge.net/project/shownotes.php?release_id=454685&group_id=104228 >> >> Please consider this release to be a Beta because it has not been tested >> thoroughly enough on Windows CE to be considered stable. I think that the >> most efficient way to continue testing will be for everyone to try it and >> report any bugs. >> >> Luke Dunstan >> >> ___ >> PythonCE mailing list >> PythonCE@python.org >> http://mail.python.org/mailman/listinfo/pythonce >> >> > > -- > View this message in context: > http://www.nabble.com/Python-2.5-for-Windows-CE---ARM-tf2427402.html#a6769570 > Sent from the Python - pythonce mailing list archive at Nabble.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
Re: [PythonCE] open internet connection (GPRS)
Title: Mensaje Hi, It should be possible to use Windows CE APIs through ctypes to do it, but I am not sure which is the most appropriate. I would guess either RasDial or InternetOpen, which in PythonCE would be ctypes.cdll.coredll.RasDial() or ctypes.cdll.wininet.InternetOpenW(). Luke - Original Message - From: Fredy Cabre To: pythonce@python.org Sent: Saturday, October 14, 2006 6:04 AM Subject: [PythonCE] open internet connection (GPRS) Hello, I have a scrypt that send files to web server by FTP, this runs very good, but everytime I want to send the files with the script, previously I have to open the internet explorer to make me the internet connection. Exist any method wich connect to internet (GPRS) directly before I send the files by FTP? Thankyou. ___PythonCE mailing listPythonCE@python.orghttp://mail.python.org/mailman/listinfo/pythonce ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python 2.5 for Windows CE / ARM
- Original Message - From: "David Fraser" <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]> Cc: Sent: Thursday, October 12, 2006 11:35 PM Subject: Re: [PythonCE] Python 2.5 for Windows CE / ARM > Luke Dunstan wrote: >> A new release of Python for Windows CE is available. Download it here: >> >> http://sourceforge.net/project/showfiles.php?group_id=104228 >> >> The release notes are linked from this page, but a direct link is: >> >> http://sourceforge.net/project/shownotes.php?release_id=454685&group_id=104228 >> >> Please consider this release to be a Beta because it has not been tested >> thoroughly enough on Windows CE to be considered stable. I think that the >> most efficient way to continue testing will be for everyone to try it and >> report any bugs. > Fantastic... The new modules mean much less hassle for deploying our web > server app on CE now :-) > Seems and sounds like sqlite3 is not supported (error importing > _sqlite3), any chance of updating the wiki to show the differences? > And since I'm new on this, what's the quickest/easiest way of helping to > get _sqlite3 working? > > > David I have now added a file PythonCE-2.5-20061012-pysqlite.zip to the release containing the missing pySQLite DLLs. Please try it. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python 2.5 for Windows CE / ARM
- Original Message - From: " Luke Dunstan" <[EMAIL PROTECTED]> To: Sent: Thursday, October 12, 2006 5:59 PM Subject: Re: [PythonCE] Python 2.5 for Windows CE / ARM > > - Original Message - > From: "Bandung" <[EMAIL PROTECTED]> > To: > Sent: Thursday, October 12, 2006 12:09 PM > Subject: Re: [PythonCE] Python 2.5 for Windows CE / ARM > >> Also, import dbapi2 isn't recognized as a legitimate command (possibly >> due >> to the current default paths) > > I think this is because the release doesn't include pySQLite yet. As I mentioned in another email, I have now added PythonCE-2.5-20061012-pysqlite.zip to the release, which contains the missing pySQLite DLLs. Luke > >> Will the durus persistence modules be eventually added with this release. > > What is it? Is it a part of the standard library? > > Luke > >> >> >> >> Luke Dunstan wrote: >>> >>> A new release of Python for Windows CE is available. Download it here: >>> >>> http://sourceforge.net/project/showfiles.php?group_id=104228 >>> >>> The release notes are linked from this page, but a direct link is: >>> >>> http://sourceforge.net/project/shownotes.php?release_id=454685&group_id=104228 >>> >>> Please consider this release to be a Beta because it has not been tested >>> thoroughly enough on Windows CE to be considered stable. I think that >>> the >>> most efficient way to continue testing will be for everyone to try it >>> and >>> report any bugs. >>> >>> Luke Dunstan ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python 2.5 for Windows CE / ARM
Hi, Please download the file I've just added to the release (PythonCE-2.5-20061012-_tkinter.zip) and try it. It should work the same way as previous versions. Luke - Original Message - From: <[EMAIL PROTECTED]> To: "coder_infidel" <[EMAIL PROTECTED]> Sent: Monday, October 16, 2006 5:08 PM Subject: Re: [PythonCE] Python 2.5 for Windows CE / ARM Great work for db sqlite!!! When could we have Tkinter in Python 2.5? I tried to copy DLLs\_tkinter.pyd but Tkinter doesn't work ... Thank's a lot bye ivom > > ----- Original Message - > From: " Luke Dunstan" <[EMAIL PROTECTED]> > To: > Sent: Thursday, October 12, 2006 5:59 PM > Subject: Re: [PythonCE] Python 2.5 for Windows CE / ARM > > > > > > - Original Message - > > From: "Bandung" <[EMAIL PROTECTED]> > > To: > > Sent: Thursday, October 12, 2006 12:09 PM > > Subject: Re: [PythonCE] Python 2.5 for Windows CE / ARM > > > >> Also, import dbapi2 isn't recognized as a legitimate command (possibly > >> due > >> to the current default paths) > > > > I think this is because the release doesn't include pySQLite yet. > > As I mentioned in another email, I have now added > PythonCE-2.5-20061012-pysqlite.zip to the release, which contains the > missing pySQLite DLLs. > > Luke > > > > >> Will the durus persistence modules be eventually added with this > >> release. > > > > What is it? Is it a part of the standard library? > > > > Luke > > > >> > >> > >> > >> Luke Dunstan wrote: > >>> > >>> A new release of Python for Windows CE is available. Download it here: > >>> > >>> http://sourceforge.net/project/showfiles.php?group_id=104228 > >>> > >>> The release notes are linked from this page, but a direct link is: > >>> > >>> http://sourceforge.net/project/shownotes.php?release_id=454685&group_id=104228 > >>> > >>> Please consider this release to be a Beta because it has not been > >>> tested > >>> thoroughly enough on Windows CE to be considered stable. I think that > >>> the > >>> most efficient way to continue testing will be for everyone to try it > >>> and > >>> report any bugs. > >>> > >>> Luke Dunstan > > ___ > PythonCE mailing list > PythonCE@python.org > http://mail.python.org/mailman/listinfo/pythonce > -- Consolidamento.Una sola rata più bassa per i tuoi finanziamenti e, in più, liquidità! http://click.libero.it/mutuionline10 ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Is SH3 supported
- Original Message - From: "Peter Olson" <[EMAIL PROTECTED]> To: Sent: Wednesday, October 18, 2006 10:02 AM Subject: [PythonCE] Is SH3 supported > Hi I was wondering if there was a python version for ether the SH3 > processers or for an HPC ARM device. If there is, could some point me > in the direction of it? > > TIA, > Peter I'm not aware of any, and I don't think there has been any recent work on a Windows CE 3.x (or earlier) version for any processor. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] IndentationError in 2.5 command line interpreter
- Original Message - From: <[EMAIL PROTECTED]> To: "Pythonce" Sent: Friday, October 20, 2006 8:59 PM Subject: [PythonCE] IndentationError in 2.5 command line interpreter If I try to write a multi-line construct in the Pythonce 2.5 command line interpreter, I get an IndentationError when I press Enter after a line with some control flow statement. For example, consider this simple example: for i in xrange(10): When I press Enter at this point, I get: IndentationError: expected an indented block. In Pythonce 2.4.3 and earlier, pressing Enter forced a line break and I could include the necessary indentation on the continuation line. Is it a known issue that this behavior no longer works? Thanks for your help. Please try the attached script to see if it fixes the problem. Just put it on your Pocket PC and double-click it. Luke # # A builtin Python Console for Windows/CE # # David Kashtan, Validus Medical Systems # import sys import _pcceshell_support # # If we can't import traceback, use a local print_exception function # try: # # Import traceback and use its print_exception function # import traceback print_exception = traceback.print_exception except: # # Local print_exception # def print_exception(Type, Value, Traceback, Limit=None): # # Print a warning message (once) # if "_Import_Message_Printed" not in globals(): global _Import_Message_Printed _Import_Message_Printed = True print "Warning: Unable to import traceback, using internal (minimal) traceback" # # If there is no limit on the traceback depth, make it sys.tracebacklimit # if Limit is None: if hasattr(sys, "tracebacklimit"): Limit = sys.tracebacklimit else: Limit = 10 # # Work our way up the traceback stack and output a line for each frame (up to the depth limit) # if Traceback is not None and Limit > 0: sys.stderr.write("Traceback (most recent call last):\n") while Traceback is not None and Limit > 0: Code = Traceback.tb_frame.f_code sys.stderr.write(" File \"%s\", line %d, in %s\n"%(Code.co_filename, Traceback.tb_lineno, Code.co_name)) Traceback = Traceback.tb_next Limit -= 1 # # Output the exception information # Type = str(Type) if "." in Type: Type = Type[Type.index(".")+1:] sys.stderr.write("%s: %s\n"%(str(Type), str(Value))) # # Add a writelines function to the PCCESHELL # def _writelines(File, Lines): for Line in Lines: File.write(Line) _pcceshell_support.writelines = _writelines # # Entry point from python.c: Wait for input, compile it and execute it # def main(): # # Attempt to load the telnet server # try: import telnetd except ImportError: pass try: # # Initialize the session # Locals = {} sys.stdout.write("Python %s on %s\n%s" % (sys.version, sys.platform, sys.ps1)) while 1: # # Wait for input or exit # if not _pcceshell_support.Wait(): break # # Get the text to execute and compile it # Code_Text = _pcceshell_support.Get_Input_Text() if not Code_Text: continue try: try: Code_Object = compile(Code_Text, "", "single") except SyntaxError, Error: try: Code_Object = compile(Code_Text + "\n", "", "single") except SyntaxError, Error1: try: Code_Object = compile(Code_Text + "\n\n", "", "single") except SyntaxError, Error2: if Code_Text.endswith("\n\n"): raise SyntaxError, Error1 try: # Python 2.4: e1 = Error1.__dict__ e1 = repr(Error1) except AttributeError: e1 = Error1 try: # Python 2.4: e2 = Error2.__dict__ e2 = repr(Error2) except AttributeError: e2 = Error2 if e1 == e2: raise SyntaxError, Error1 Code_Object = None except SyntaxError: # # Compiler reported a syntax error # sys.stdout.write("\n") Args = sys.exc_info() + (0,) print_exception(*Args) sys.stdout.write(sys.ps1) continue except: # #
Re: [PythonCE] IndentationError in 2.5 command line interpreter
- Original Message - From: <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]>; "Pythonce" Sent: Saturday, October 28, 2006 8:55 PM Subject: Re: [PythonCE] IndentationError in 2.5 command line interpreter I tried, but the script terminates without a message. So, I can't really get the script to run. Thanks for your help. Sorry, I forgot something. Try this one. Luke -----Original Message- From: Luke Dunstan <[EMAIL PROTECTED]> Sent: Oct 27, 2006 11:57 AM To: [EMAIL PROTECTED], Pythonce Subject: Re: [PythonCE] IndentationError in 2.5 command line interpreter - Original Message - From: <[EMAIL PROTECTED]> To: "Pythonce" Sent: Friday, October 20, 2006 8:59 PM Subject: [PythonCE] IndentationError in 2.5 command line interpreter If I try to write a multi-line construct in the Pythonce 2.5 command line interpreter, I get an IndentationError when I press Enter after a line with some control flow statement. For example, consider this simple example: for i in xrange(10): When I press Enter at this point, I get: IndentationError: expected an indented block. In Pythonce 2.4.3 and earlier, pressing Enter forced a line break and I could include the necessary indentation on the continuation line. Is it a known issue that this behavior no longer works? Thanks for your help. Please try the attached script to see if it fixes the problem. Just put it on your Pocket PC and double-click it. Luke # # A builtin Python Console for Windows/CE # # David Kashtan, Validus Medical Systems # import sys import _pcceshell_support # # If we can't import traceback, use a local print_exception function # try: # # Import traceback and use its print_exception function # import traceback print_exception = traceback.print_exception except: # # Local print_exception # def print_exception(Type, Value, Traceback, Limit=None): # # Print a warning message (once) # if "_Import_Message_Printed" not in globals(): global _Import_Message_Printed _Import_Message_Printed = True print "Warning: Unable to import traceback, using internal (minimal) traceback" # # If there is no limit on the traceback depth, make it sys.tracebacklimit # if Limit is None: if hasattr(sys, "tracebacklimit"): Limit = sys.tracebacklimit else: Limit = 10 # # Work our way up the traceback stack and output a line for each frame (up to the depth limit) # if Traceback is not None and Limit > 0: sys.stderr.write("Traceback (most recent call last):\n") while Traceback is not None and Limit > 0: Code = Traceback.tb_frame.f_code sys.stderr.write(" File \"%s\", line %d, in %s\n"%(Code.co_filename, Traceback.tb_lineno, Code.co_name)) Traceback = Traceback.tb_next Limit -= 1 # # Output the exception information # Type = str(Type) if "." in Type: Type = Type[Type.index(".")+1:] sys.stderr.write("%s: %s\n"%(str(Type), str(Value))) # # Add a writelines function to the PCCESHELL # def _writelines(File, Lines): for Line in Lines: File.write(Line) _pcceshell_support.writelines = _writelines # # Entry point from python.c: Wait for input, compile it and execute it # def main(): # # Attempt to load the telnet server # try: import telnetd except ImportError: pass try: # # Initialize the session # Locals = {} sys.stdout.write("Python %s on %s\n%s" % (sys.version, sys.platform, sys.ps1)) while 1: # # Wait for input or exit # if not _pcceshell_support.Wait(): break # # Get the text to execute and compile it # Code_Text = _pcceshell_support.Get_Input_Text() if not Code_Text: continue try: try: Code_Object = compile(Code_Text, "", "single") except SyntaxError, Error: try: Code_Object = compile(Code_Text + "\n", "", "single") except SyntaxError, Error1: try: Code_Object = compile(Code_Text + "\n\n", "", "single") except SyntaxError, Error2: if Code_Text.endswith("\n\n"): raise SyntaxError, Error1 try: # Python 2.4: e1 = Error1.__dict__
Re: [PythonCE] pythonce on Motorola Q?
- Original Message - From: "awaretek" <[EMAIL PROTECTED]> To: Sent: Thursday, November 02, 2006 5:19 AM Subject: [PythonCE] pythonce on Motorola Q? > > Has anyone been able to get pythonce up and running on a Motorola Q? I > have > tried the various versions on Sourceforge, but I get the error message > "not > intended for this device" when I attempt to load them on my phone. > > We know pythonce runs on Moibile System 5.0 devices, but I haven't yet > heard > from anyone who has it on the Q. I'm not sure why it woudl be different, > but > it seems to be. > > Ron Stephens Apparently applications built for "Pocket PC" are not binary compatible with "Smartphone". Are you a C/C++ programmer? If so, can you try compiling PythonCE yourself for Smartphone? Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] How to edit python files within WinCE env?
- Original Message - From: "Benjamin Scherrey" <[EMAIL PROTECTED]> To: Sent: Wednesday, November 08, 2006 12:53 PM Subject: [PythonCE] How to edit python files within WinCE env? > I'm brand spanking new to this mobile stuff so was pleased with how easy > it was to install pythonce on my new Dopod 818pro. I copied over a few > sample python programs from my development directory and they just > worked first time. Anyway - couple of newbie questions: > >1. (bit off topic) Does Windows Mobile not have the concept of a > file extension? I copied a few *.py and *.pyc files but I can only see > the primary file name before the "." which means in the file listing it > looks like the same file twice. > >2. How do I edit a python file within the environment? Clicking on > any of my copied programs results in its execution and I can't seem to > load them in an editor. As another person already mentioned: Total Commander. > >3. When typing at the command prompt for a multi-line statement like >for x in y: >print x > At the point of the pythonce complains as though that was > the end of my statement and doesn't let me enter the indented second line. This bug was reported a little while ago and I posted a Python script that works around it. It will be fixed in the next release. >4. Is there an up-to-date wiki or support web page for pythonce? I > found an old wiki but it doesn't seem to have been updated for a few > years. Yes there is a wiki at http://pythonce.sourceforge.net/Wikka/HomePage. Luke >Thanx all for the great product port (I actually ran 2.5 on my Dopod > before I got it on my dev machines) and I look forward to doing some > serious python mobile development soon. > >-- Ben Scherrey ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] ne
- Original Message - From: "Carlo Antonio Denaro" <[EMAIL PROTECTED]> To: Sent: Saturday, December 23, 2006 12:02 AM Subject: [PythonCE] ne > Hi to all developers, > my name is Charles and im a student. > I love python and i have a Nec Mobilepro 790 with > wince 3.0 and linux (yeah!) > > i can use pythonce on this device? > thanks :) and happy coding xmas There may be an old version of PythonCE that runs on Windows CE 3.0, I don't know. The latest releases have only been tested on Pocket PC 2003 (Windows CE 4.2) and later. If you wish to submit patches to allow the latest release to run on WinCE 3.0 then that would be helpful. I can't comment on whether Python would run under Linux on your PDA. Luke > > > > < Carlo Antonio Denaro a.k.a. Blackout > /.-./..-/---/ > < Linux User #374633 > [ >:-/ - evil ] > > * echelon suck usa poison gas terrorist Islam secret > * rib attempted nuclear bomb attack bacteria unfaithful ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Python Error
- Original Message - From: "Andrew Burton" <[EMAIL PROTECTED]> To: Sent: Friday, December 29, 2006 12:55 PM Subject: [PythonCE] Python Error > I'm still looking for the fix on my own, but has anyone seen this error: > > Traceback (innermost last): > File "\Program Files\Python\lib\pcceshell.py", line 12 in > from win32gui import * > exceptions.ImportError.DLL load failed with error code 12 > > I loaded the latest version of Python CE onto my T-Mobile Dash, copied > everything to Windows and Program Files, just as the instructions said. > Can anyone offer a suggestion what I've done wrong? Thanks! Which file did you download, exactly? The above code is not in any recent version of PythonCE. Perhaps the file pcceshell.py is left over from an old version? Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] How tobuild PythonCE 2.5
- Original Message - From: "Naiqian Lu" <[EMAIL PROTECTED]> To: Sent: Friday, December 29, 2006 10:02 AM Subject: [PythonCE] How tobuild PythonCE 2.5 > Hi, > > I have download pythonce source, and try to build it > to generate CAB file, just for familiar with python > code. > > What I found out is that Scons will not build. It > shows: > > C:\Source\python-wince\PCbuild\WinCE>scons > scons: Reading SConscript files ... > : global name 'defpaths' > is not defined: > > the defpaths was used in msevc to get include, lib, > and exe path. But I could not find where it gets > defined (and set). > > The old version (2.4.3) use nmake, and set the path in > batch file. > > Does the source package for 2.5 missing something? And > where should I set the defpaths? It is a bug in msevc.py, but I didn't notice it before so there must be something different on your PC. Do you have Microsoft eMbedded Visual C++ 4.0 installed? Do you have the Pocket PC 2003 SDK installed? If you really need to use a different SDK then changes to the build system and/or source code may be necessary. If you have both of these then what directories are they installed in? Luke > > Thanks in advance! > > Happy New Year! > > Naiqian Lu ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] How tobuild PythonCE 2.5
- Original Message - From: "Naiqian Lu" <[EMAIL PROTECTED]> To: "Luke Dunstan" <[EMAIL PROTECTED]>; Sent: Wednesday, January 03, 2007 5:29 AM Subject: Re: [PythonCE] How tobuild PythonCE 2.5 > Hi, > > Here is my builing env: > > New desktop PC with WinXP sp2 > EVC 4.0 with sp4 > Pocket PC 2003 SDK OK, that is what I have too, so we will have to debug the script by inspecting your registry using regedit and perhaps by adding "print" statements in a few places. Firstly though, please be aware that I wrote this code to find the EVC/SDK directories by digging through the registry on my PC so it is possible that I could have made some incorrect assumptions about how it works. Anyway, near the top of SConstruct you will see: env = Environment( MSEVC_PLATFORM = 'POCKET PC 2003', MSEVC_SUBPLATFORM = 'Win32 (WCE ARMV4)', tools = ['mslink', 'msevc', 'zip'], toolpath = '.' ) The setting MSEVC_PLATFORM tells msevc.py to call find_platform_by_name('POCKET PC 2003'). This function enumerates the subkeys of the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Tools\Platform Manager\{F384D888-F9AA-11D1-BB9E-00A0C9C9CCEE} First check whether this exists on your PC. On mine it contains three subkeys: {3BD0FD9A-A1F3-4C83-AD6E-649C3BD5C479} (Default) = "Windows CE Default Platform" {8786CEC0-7256-413A-BAA3-39B5F435A826} (Default) = "POCKET PC 2003" {DB9D1DD0-D249-4BE1-83FF-4AB58F2FBA09} (Default) = "STANDARDSDK" Please check whether you have the Pocket PC 2003 one. If this is all OK then the next step is where it calls find_subplatform_by_name(hkey, platform_guid, 'Win32 (WCE ARMV4)'). In the case of the Pocket PC 2003 SDK, this function enumerates the subkeys of the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Tools\Platform Manager\{F384D888-F9AA-11D1-BB9E-00A0C9C9CCEE}\{8786CEC0-7256-413A-BAA3-39B5F435A826}\{F384D894-F9AA-11D1-BB9E-00A0C9C9CCEE}\{8786CEC0-7256-413A-BAA3-39B5F435A826} Notice that the fourth GUID in this path is the same as the second GUID (the platform GUID). On my PC it contains two subkeys: {32E52003-403E-442D-BE48-DE10F8C6131D} {D6518FFB-710F-11D3-99F2-00105A0DF099} In regedit it may not be obvious but each of these contains a "Display Name" value with the name of the "subplatform" (or architecture if you like), stored as the binary representation of the Unicode string. We are interested in the second subkey {D6518FFB-710F-11D3-99F2-00105A0DF099} which has a display name 'Win32 (WCE ARMV4)' on my PC. This subkey contains three other values "Include Dirs", "Lib Dirs", "Path Dirs" and "Src Dirs", and these are the ones it apparently failed to find on your PC. If you got this far then hopefully you can tell me where the algorithm went wrong :-) Luke > > I also has other softwares installed, but it should > not affect EVC build. > > Thanks, > > Naiqian Lu > > --- Luke Dunstan <[EMAIL PROTECTED]> wrote: > >> >> - Original Message - >> From: "Naiqian Lu" <[EMAIL PROTECTED]> >> To: >> Sent: Friday, December 29, 2006 10:02 AM >> Subject: [PythonCE] How tobuild PythonCE 2.5 >> >> >> > Hi, >> > >> > I have download pythonce source, and try to build >> it >> > to generate CAB file, just for familiar with >> python >> > code. >> > >> > What I found out is that Scons will not build. It >> > shows: >> > >> > C:\Source\python-wince\PCbuild\WinCE>scons >> > scons: Reading SConscript files ... >> > : global name >> 'defpaths' >> > is not defined: >> > >> > the defpaths was used in msevc to get include, >> lib, >> > and exe path. But I could not find where it gets >> > defined (and set). >> > >> > The old version (2.4.3) use nmake, and set the >> path in >> > batch file. >> > >> > Does the source package for 2.5 missing something? >> And >> > where should I set the defpaths? >> >> It is a bug in msevc.py, but I didn't notice it >> before so there must be >> something different on your PC. Do you have >> Microsoft eMbedded Visual C++ >> 4.0 installed? Do you have the Pocket PC 2003 SDK >> installed? If you really >> need to use a different SDK then changes to the >> build system and/or source >> code may be necessary. If you have both of these >> then what directories are >> they installed in? >> >> Luke >> >> > >> > Thanks in advance! >> > >> > Happy New Year! >> > >> > Naiqian Lu ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Accessing serial port with PythonCE 2.5
- Original Message - From: "David Goncalves" <[EMAIL PROTECTED]> To: Sent: Wednesday, January 03, 2007 3:09 AM Subject: [PythonCE] Accessing serial port with PythonCE 2.5 Hi, Everything is in the subject ;) Is there any way to access the serial port with that build of PythonCE ? I've not found any 'serial' module to import. Regards. Well there is no "serial" module included with PythonCE, but Python on my PC doesn't have such a module either. I haven't done it myself on PythonCE but I think the best way would be to use ctypes to access the Win32 serial communications APIs. I have written some code to do this on the PC, so I have attached it. This code is not intended to be particularly efficient because I only used it to write a serial protocol simulator, but hopefully it is fairly simple to use. Again, I haven't tried it on Windows CE but I think it should work with minor changes. For example, I can see that SerialPort.__init__() would have to be modified slightly to open e.g. "COM1:" instead of "\\.\COM1". Luke import ctypes import threading import time import Queue # # # NOTE: I am using unicode APIs in case this code is used on WinCE in future BYTE = ctypes.c_ubyte CHAR = ctypes.c_char LPVOID = ctypes.c_void_p LPCWSTR = ctypes.c_wchar_p WORD = ctypes.c_ushort DWORD = ctypes.c_uint HANDLE = DWORD INVALID_HANDLE_VALUE = -1 #0xL GENERIC_READ = 0x8000L GENERIC_WRITE = 0x4000L GENERIC_EXECUTE = 0x2000L GENERIC_ALL = 0x1000L CREATE_NEW = 1 CREATE_ALWAYS = 2 OPEN_EXISTING = 3 OPEN_ALWAYS = 4 TRUNCATE_EXISTING = 5 def CheckHANDLE(value): if value == INVALID_HANDLE_VALUE: raise ctypes.WinError() return value def CheckBOOL(value): if not value: raise ctypes.WinError() return value class DCB(ctypes.Structure): FLAG_BINARY = 0x1 FLAG_PARITY = 0x2 FLAG_OUTXCTSFLOW = 0x4 FLAG_OUTXDSRFLOW = 0x8 MASK_DTRCONTROL = 0x30 DTR_CONTROL_ENABLE = 0x10 FLAG_DSRSENSITIVITY = 0x40 FLAG_TXCONTINUEONXOFF = 0x80 FLAG_OUTX = 0x100 FLAG_INX = 0x200 FLAG_ERROR_CHAR = 0x400 FLAG_NULL = 0x800 MASK_RTS_CONTROL = 0x3000 RTS_CONTROL_ENABLE = 0x1000 NOPARITY = 0 ODDPARITY = 1 EVENPARITY = 2 MARKPARITY = 3 SPACEPARITY = 4 ONESTOPBIT = 0 ONE5STOPBITS = 1 TWOSTOPBITS = 2 _fields_ = [ ('DCBlength', DWORD), ('BaudRate', DWORD), ('flags', DWORD), ('wReserved', WORD), ('XonLim', WORD), ('XoffLim', WORD), ('ByteSize', BYTE), ('Parity', BYTE), ('StopBits', BYTE), # 0=1, 1=1.5, 2=2 ('XonChar', CHAR), ('XoffChar', CHAR), ('ErrorChar', CHAR), ('EofChar', CHAR), ('EvtChar', CHAR), ('wReserved1', WORD), ] def __init__(self): ctypes.Structure.__init__(self) self.DCBlength = ctypes.sizeof(self) MAXDWORD = 0xL class COMMTIMEOUTS(ctypes.Structure): _fields_ = [ ('ReadIntervalTimeout', DWORD), ('ReadTotalTimeoutMultiplier', DWORD), ('ReadTotalTimeoutConstant', DWORD), ('WriteTotalTimeoutMultiplier', DWORD), ('WriteTotalTimeoutConstant', DWORD), ] SETXOFF = 1 SETXON = 2 SETRTS = 3 CLRRTS = 4 SETDTR = 5 CLRDTR = 6 SETBREAK = 8 CLRBREAK = 9 kernel32 = ctypes.windll.kernel32 CreateFileW = kernel32.CreateFileW # TODO: support SECURITY_ATTRIBUTES CreateFileW.argtypes = [ LPCWSTR, DWORD, DWORD, LPVOID, DWORD, DWORD, HANDLE ] CreateFileW.restype = CheckHANDLE CloseHandle = kernel32.CloseHandle CloseHandle.argtypes = [ HANDLE ] CloseHandle.restype = CheckBOOL ReadFile = kernel32.ReadFile # TODO: support OVERLAPPED ReadFile.argtypes = [ HANDLE, LPVOID, DWORD, ctypes.POINTER(DWORD), LPVOID ] ReadFile.restype = CheckBOOL WriteFile = kernel32.WriteFile # TODO: support OVERLAPPED WriteFile.argtypes = [ HANDLE, LPVOID, DWORD, ctypes.POINTER(DWORD), LPVOID ] WriteFile.restype = CheckBOOL GetCommState = kernel32.GetCommState GetCommState.argtypes = [ HANDLE, ctypes.POINTER(DCB) ] GetCommState.restype = CheckBOOL SetCommState = kernel32.SetCommState SetCommState.argtypes = [ HANDLE, ctypes.POINTER(DCB) ] SetCommState.restype = CheckBOOL GetCommTimeouts = kernel32.GetCommTimeouts GetCommTimeouts.argtypes = [ HANDLE, ctypes.POINTER(COMMTIMEOUTS) ] GetCommTimeouts.restype = CheckBOOL SetCommTimeouts = kernel32.SetCommTimeouts SetCommTimeouts.argtypes = [ HANDLE, ctypes.POINTER(COMMTIMEOUTS) ] SetCommTimeouts.restype = CheckBOOL SetupComm = kernel32.SetupComm SetupComm.argtypes = [ HANDLE, DWORD, DWORD ] SetupComm.restype = CheckBOOL EscapeCommFunction = kernel32.EscapeCommFunction EscapeCommFunction.argtypes = [ HANDLE, DWORD ] EscapeCommFunction.restype = CheckBOOL # class SerialPort(object): def __init__(self, name): if not name.startswith('.\\'): name = '.\\' + name self.name = name
Re: [PythonCE] Bluetooth
- Original Message - From: <[EMAIL PROTECTED]> To: Sent: Monday, January 15, 2007 6:24 PM Subject: [PythonCE] Bluetooth > Hello, I'm new to PythonCE so apologize if the question was already > answered (I searched through the archive withot success). > Yesterday I installed on my Dell Axim PythonCE 2.5, last version. I tryed > to do an example using the bluetooth connection without success. Today I > downloaded the source code but I couldn't find any bluetooth.h or file > related to bluetooth. So my suspect is that bluetooth is not supported in > PythonCE. Is this true? Or am I wrong (I'm not an expert in Python > building)? > If somebody had success on using bluetooth and would like to share a > little > example this will be very appreciated. > > Thank you very much, > Enrico Does Python support Bluetooth? If not then I am not surprised that it is not supported by PythonCE. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] Bug?
- Original Message - From: <[EMAIL PROTECTED]> To: Sent: Monday, January 15, 2007 7:03 PM Subject: [PythonCE] Bug? > Hello, trying to discover if socket module has bluetooth support, I typed > in the python console help(socket). This blocks the idle, no other action > it's possible. If I do help(another-module) there's no problem (example > help(os)). > I'm working on a Dell Axim x51v, python 2.5 last release. > > Regards and thanks, Enrico Yes, it looks like a bug. I'll try to investigate when I can. Luke ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce
Re: [PythonCE] annoying progress clock while running wxPython
try: import _pcceshell_support except ImportError: # This can happen if PythonCE was started with the /nopcceshell argument pass else: _pcceshell_support.Busy(0) Luke - Original Message - From: Stefan Johansson To: Matt S. ; PythonCE@python.org Sent: Friday, January 26, 2007 7:39 AM Subject: Re: [PythonCE] annoying progress clock while running wxPython I had the same problem. It does eventually go away but it takes a long time, like minutes. Unfortunately I never found a solution. Stefan - Original Message From: Matt S. <[EMAIL PROTECTED]> To: PythonCE@python.org Sent: Thursday, January 25, 2007 4:28:20 PM Subject: [PythonCE] annoying progress clock while running wxPython When I run wxPython code on my windows mobile 4.0 device I get this pin-wheel like progress clock that won't go away. I can interact with the widgets, no problem, but the pin-wheel is a real eyesore. I'm running PythonCE 2.4 and wxPython 2.7.0. Has anyone ran into this problem or does anyone know how to resolve it? Thanks! Matt ___ 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 ___ PythonCE mailing list PythonCE@python.org http://mail.python.org/mailman/listinfo/pythonce