Re: [Tutor] Starting python from a DOS prompt from any directory?
"Daniel McQuay" <[EMAIL PROTECTED]> wrote > from a DOS prompt. i am used to running python from a linux box > where you > can just type "python" or "python24" from a shell prompt and the > python > shell executes from any directory. > testing code. now i am using a windows xp media center edition > laptop with > python 2.5 installed and when i go to run and then type "cmd" and > then type > "python" from the directory where the run "cmd" command drops me it > says > 'python' is not a recognized as an internal or external command. You need to set up your PATH environment variable to include the python directory. You do this on XP(not so sure about Media Centre!) via the MyComputer->Properties->Advanced->Environment Variables route Once there you need to find the PATH variable and edit it to add the folder where Python lives (look at the properties of the shortcut to Python that you normally use to stat it). HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Starting python from a DOS prompt from any directory?
Alan Gauld wrote: > "Daniel McQuay" <[EMAIL PROTECTED]> wrote > > >> from a DOS prompt. i am used to running python from a linux box >> where you >> can just type "python" or "python24" from a shell prompt and the >> python >> shell executes from any directory. >> > > >> testing code. now i am using a windows xp media center edition >> laptop with >> python 2.5 installed and when i go to run and then type "cmd" and >> then type >> "python" from the directory where the run "cmd" command drops me it >> says >> 'python' is not a recognized as an internal or external command. >> > > You need to set up your PATH environment variable to include the > python directory. You do this on XP(not so sure about Media Centre!) > via the MyComputer->Properties->Advanced->Environment Variables route > Once there you need to find the PATH variable and edit it to add the > folder where Python lives (look at the properties of the shortcut to > Python that you normally use to stat it). > Also, if you just need a temporary fix (say you're using Python on someone else's system and you don't want to permanently change their PATH) you can type path = %path%;c:\python25 to add it to your path just for that DOS session. HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] XML-RPC data transfers.
"Chris Hengge" <[EMAIL PROTECTED]> wrote > method is a good one. Much like your own answers to most of my > questions, > you state several ways varying from "probably works" to "how I'd try > to do > it". Personally, I'd rather understand more of the "how I know it > works" One reason may be that you are doing something unusual. Like sending images directly from memory over an XMLRPC connection. It should be possible but its not likely something many perople on this list will have actually done. So you only get suggestions of how they *might* do it ifd they had to. Because of the reliability issues with XMLRPC I'd always save image data to a file and send the file. (As I said earlier I'd try to avoid sending the file via RPC but thats another story that we've covered') But the advantages of having a file mean that the whole process is much more repeatable and resilient particularly if the object you are trying to send is subject to change - like a screen shot. If you have to resend because of RPC errors then the new screen grab might be different to the original. The alternative involves holding the screen image in RAM for a longish time which makes your program into a resource hog which is also bad practice... although with PCs having hundreds of Meg of RAM nowadays its sadly becoming more common! Bloatware rules :-( But I suspect the main reason you aren't getting working examples is simply that you are trying to do something that is outside normal programming experience on this list. But I may be wrong! ;-) -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] question about importing threads
Thanks, Alan. Yes, the thing is getting to be a pain to deal with at this size, i am in-process of splitting out the classes into their own files. Thanks for your help. shawn On 12/30/06, Alan Gauld <[EMAIL PROTECTED]> wrote: "shawn bright" <[EMAIL PROTECTED]> wrote i > testing this right away. This long a .py script is becomming a > headache and > i think it will be easier by far if it is pulled apart somewhat. As a general rule of thumb, any Python script (or any programming language file for that matter!) that gets longer than 4 or 5 hundred lines should be looked at closely in terms of splitting it into modules. There are a few (very few) times where I've seen a thousand line file that was justified, but nearly any time you get beyond 500 lines you should be splitting things up - especially in high level languages like Python where the methods/functions tend to be short anyway. FWIW A quick check of the Python standard library shows the average file size there to be: 459 lines(*) And that's pretty high IMHO! There are 19 files over a thousand lines and the biggest file is over 3000 lines... which seems way too big to me! But that's out of 188 files... (*) Cygwin; Python 2.4 In case you want to repeat for your version I used: >>> libs = [len(open(f).readlines()) for f in glob('*.py')] >>> print sum(libs)/len(libs) >>> print max(libs) >>> print len([s for s in libs if s>1000]) Alan G ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] question about importing threads
"shawn bright" <[EMAIL PROTECTED]> wrote > Yes, the thing is getting to be a pain to deal with at this size, i > am > in-process of splitting out the classes into their own files. One thing to watch is that while its easy and tempting to create one file per class it's often better to keep dependant classes together. In other words if class A can only be used together with class B then it is often better to keep A and B in the same module. Anyone who needs B can import the module and anyone who needs A needs B too so it saves them having to import two modules. As in all things in programming a little bit of thought is often better than the first "obvious" strategy. Grady Booch described the above strategy by saying that "the unit of reuse is the category" (which in his OO notation was a set of related classes) and in Python that means the module. Regards, Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Starting python from a DOS prompt from any directory?
I am learning Python on the office computer which is networked, and am not allowed to change defaults (programmers aren't allowed to do system admin stuff, heck, we can't even move our PC's or monitors). I've got PYTHON installed in d:\python25. So at the DOS prompt, g:\ type in d:\ Then at the d:\ type in CD python25, which changes it to d:\python25. >From there, it's just python mystuff.py to run my programs. From: [EMAIL PROTECTED] on behalf of Alan Gauld Sent: Sun 12/31/2006 2:42 AM To: tutor@python.org Subject: Re: [Tutor] Starting python from a DOS prompt from any directory? "Daniel McQuay" <[EMAIL PROTECTED]> wrote > from a DOS prompt. i am used to running python from a linux box > where you > can just type "python" or "python24" from a shell prompt and the > python > shell executes from any directory. > testing code. now i am using a windows xp media center edition > laptop with > python 2.5 installed and when i go to run and then type "cmd" and > then type > "python" from the directory where the run "cmd" command drops me it > says > 'python' is not a recognized as an internal or external command. You need to set up your PATH environment variable to include the python directory. You do this on XP(not so sure about Media Centre!) via the MyComputer->Properties->Advanced->Environment Variables route Once there you need to find the PATH variable and edit it to add the folder where Python lives (look at the properties of the shortcut to Python that you normally use to stat it). HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Starting python from a DOS prompt from any directory?
"Steve Oldner" <[EMAIL PROTECTED]> wrote > change defaults (programmers aren't allowed to do system > admin stuff, heck, we can't even move our PC's or monitors). You can just type in the PATH statement every time you start DOS PATH= %PATH%;D:\Python25 And it will have the same effect. You can even create a Batch file and put it into somewhere your PATH can see D:\Python25\python %1 %2 %3 %4 %5 %6 %7 %8 %9 should work. But how did you install Python if you can't change the system? If you have access to install programs you have access to set environment variables, at least for yourself! Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Starting python from a DOS prompt from any directory?
yeah, you know what i totally didn't think about setting the environmental values (yeah Media Center is the same as XP Pro). i guess i should of known that. geeze now i feel like a moron. however, i didn't know about that quick little DOS trick. thanks a lot guys for such a quick response and pointing out the obvious. this has got to be the best and most friendly list ever. happy new year to you all, On 12/31/06, Alan Gauld <[EMAIL PROTECTED]> wrote: "Steve Oldner" <[EMAIL PROTECTED]> wrote > change defaults (programmers aren't allowed to do system > admin stuff, heck, we can't even move our PC's or monitors). You can just type in the PATH statement every time you start DOS PATH= %PATH%;D:\Python25 And it will have the same effect. You can even create a Batch file and put it into somewhere your PATH can see D:\Python25\python %1 %2 %3 %4 %5 %6 %7 %8 %9 should work. But how did you install Python if you can't change the system? If you have access to install programs you have access to set environment variables, at least for yourself! Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Daniel McQuay boxster.homelinux.org H: 814.825.0847 M: 814-341-9013 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] SPE - Stani's Python Editor ?
Hi all, some time ago i instaled SPE with python 2.4... it works very good... but yesterday my pc crash completly ( some dll went missing somehow :-) )... so after format and reinstalling of windows i begin to install all my programs back... When i come to python i download new 2.5 version and only version for win i could find is SPE-0.8.2.a-wx2.6.1.0-py24 which doesnt work... :-( newer version ist just rpm and i need exe for win... any idea if there will be exe or any more development in SPE cause homepage is not running etc... Or can you suggest similar IDE for python... ? Thanks Best regards Vladimir ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] XML-RPC data transfers.
Boo bloatware! Don't even mention those... heheh.. I even turn off most the services on my system to keep things clean.. But thats another story.. Going off your thoughts that I'm asking to do something outside the realm of the readers here, is there a better place to ask this kind of oddball stuff? I've looked around and haven't been able to find any support for XML-RPC (might be a good sign to drop it and move to something else?) I'm on the win32 list, and python-list, but I mostly just read those since in my mind most of what I have questions about are noobish things since I'm still trying to get a handle on this language... On 12/31/06, Alan Gauld <[EMAIL PROTECTED]> wrote: "Chris Hengge" <[EMAIL PROTECTED]> wrote > method is a good one. Much like your own answers to most of my > questions, > you state several ways varying from "probably works" to "how I'd try > to do > it". Personally, I'd rather understand more of the "how I know it > works" One reason may be that you are doing something unusual. Like sending images directly from memory over an XMLRPC connection. It should be possible but its not likely something many perople on this list will have actually done. So you only get suggestions of how they *might* do it ifd they had to. Because of the reliability issues with XMLRPC I'd always save image data to a file and send the file. (As I said earlier I'd try to avoid sending the file via RPC but thats another story that we've covered') But the advantages of having a file mean that the whole process is much more repeatable and resilient particularly if the object you are trying to send is subject to change - like a screen shot. If you have to resend because of RPC errors then the new screen grab might be different to the original. The alternative involves holding the screen image in RAM for a longish time which makes your program into a resource hog which is also bad practice... although with PCs having hundreds of Meg of RAM nowadays its sadly becoming more common! Bloatware rules :-( But I suspect the main reason you aren't getting working examples is simply that you are trying to do something that is outside normal programming experience on this list. But I may be wrong! ;-) -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] SPE - Stani's Python Editor ?
At 04:48 PM 12/31/2006, Vladimir Strycek wrote: Hi all, some time ago i instaled SPE with python 2.4... it works very good... but yesterday my pc crash completly ( some dll went missing somehow :-) )... so after format and reinstalling of windows i begin to install all my programs back... When i come to python i download new 2.5 version and only version for win i could find is SPE-0.8.2.a-wx2.6.1.0-py24 which doesnt work... :-( newer version ist just rpm and i need exe for win... any idea if there will be exe or any more development in SPE cause homepage is not running etc... Or can you suggest similar IDE for python... ? I have SPE 0.8.3.c, which is for Python 2.5. There is a mailing list for SPE users. See the archive at < https://lists.berlios.de/pipermail/python-spe-users/>. Stani was looking for another host for the website. His last post, of Wed Nov 29, says he has found one, and "Don't worry the SPE website will come back." In the meantime, if anyone wants a copy of the file I downloaded, SPE-0.8.3.c.win32-py2.5.exe, please contact me. "Program info Spe version 0.8.3.c Python version 2.5 (2.3 required) wxPython version 2.6.3.3. (2.6.1.0. required)" The size of SPE-0.8.3.c.win32-py2.5.exe is 1,147 KB. Dick Moores [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor