replacments for stdio?
hi, i was wondering if anyone have written a GUI module that can function as a replacment for stdin/stdout? ie. has a file like interface, by which one could just assaign it to sys.stdout or sys.stdin and have all your prints and raw_inputs and other such things shown in a GUI window? Thanks in advance, Ido Yehieli. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to pickle unpicklable objects
interesting. usually the [pickle | cpickle | marshal] modules should handle such things -- http://mail.python.org/mailman/listinfo/python-list
Re: replacments for stdio?
some thing platform independent will be preferable... (like a file like interface for TK/Tcl) -- http://mail.python.org/mailman/listinfo/python-list
Re: replacments for stdio?
Thanks martin, I'll give it a shot as soon as i get back from work! -- http://mail.python.org/mailman/listinfo/python-list
Re: how to stop info output on screen
maybe you can try replaceing sys.stdout and/or sys.stderr with a just a simple file? then everything will be written to that file instead of desplayed on the console. Cheers, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to stop info output on screen
more on the subject: your "print" statments will also be written to that file that sys.stdout directs to, so maybe that wasn't exactly the solution you wanted to hear. ok, not the nicest solution but maybe it will help you anyway: bind sys.stdout at the begining of the program to a file (don't forget to save it first! let's say stdout = sys.stdout; sys.stdout=file('myLogFile.dat','w') ), and write your own print funktion that goes something like that: def printToConsole(stringToPrint,oldStdOut): sys.stdout=oldStdOut print stringToPrint sys.stdout=file('myLogFile.dat','w') then when you want to print to the console, use this function instead of the print statment. all the rest will go to 'myLogFile.dat' Cheers, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to stop info output on screen
forget my posts, Steve's solution is much more maintanable when you(or someone else)'ll revisit the code in a couple of years. i would go with what he wrote. Cheers, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: what does 0 mean in MyApp(0)
i see you inherit from wxApp. mybe the constructor of that object takes an int value? -- http://mail.python.org/mailman/listinfo/python-list
where to post python code?
Hi all, i have written a small python game (about 300 lines of code) that i think other people might enjoy poking around (being a python programmer for the past 4 years or so (some of it professionally) I believe I could say it's not badly written either). the question it - where should i post the code to? It's not big enough to justify a source forge project, nor is it small enough to be considered a receipt fit for ASPN's Python Cookbook. it's a "scorched earth" clone by the way - and is completely playable (although without AI - only human multiplayer). It is probably among the shortest of the moderately enjoyable multiplayer python games that I've encountered... Cheers, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: where to post python code?
thanks, decided to post it to the python cheese shop over python.org instead. damn, that site is _slow_ today... -- http://mail.python.org/mailman/listinfo/python-list
Re: replacments for stdio?
yes, I've tried it aswell - nice work indeed! now, maybe also get stdin to work from this TK window... ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: replacments for stdio?
the source (and Bryan) doesn't say anything about further distribution - and he did not provide a real email address. Can I safely modify it and include it in the source distribution of my program (it is open source licensed)? Would that be the polite thing to do, i have no idea how to contact this guy? -- http://mail.python.org/mailman/listinfo/python-list
Re: replacments for stdio?
Yes, i thought so myself. Thanks, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: searching a project to contribute to
Thank you all for your advice, I currently have several offers that I'm really tempted about - I will take a closer look at both of them (as well as continue searching) and will make an educated decision within the next few days. I've also decided to get rid of the sily pseudonym... -- http://mail.python.org/mailman/listinfo/python-list
Re: Extended List Comprehension
As Paul already demonstrated, this is hardly needed since it can be done more clearly with existing lang. features. -- http://mail.python.org/mailman/listinfo/python-list
Re: Redirecting standard out in a single namespace
I'm sorry, but i don't see how this will solve the problem? It is exactly the same, only now you've replaced everything in sys except just sys.stdout? At any rate, perhapse the code you will write will be more maintainable if instead of redirecting sys.stdout for some of the code just use a different function (instead of print) for the times where you wish it to be redirected somewhere else? it will probably make your code longer, but the maintainer will have one less "gotcha" to worry about a few months/years down the road. perhapse it is best to not do the "clever" thing this time ;-) ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Redirecting standard out in a single namespace
oh, ok... I guess people have to learn to use a logger instead of print in production code... -- http://mail.python.org/mailman/listinfo/python-list
Re: Using non-ascii symbols
>> Is this idea absurd or will one day our children think >> that restricting to 7-bit ascii was absurd? Both... this idea will only become none-absurd when unicode will become as prevalent as ascii, i.e. unicode keyboards, universal support under almost every application, and so on. Even if you can easly type it on your macintosh, good luck using it while using said macintosh to ssh or telnet to a remote server and trying to type unicode... -- http://mail.python.org/mailman/listinfo/python-list
Re: Using non-ascii symbols
I still remember it not being supported on most or all big Iron servers at my previuos uni (were mostly SunOS, Digital UNIX among others) -- http://mail.python.org/mailman/listinfo/python-list
Re: Loading a Python collection from an text-file
perhapse consider using the pickle module? http://docs.python.org/lib/module-pickle.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Loading a Python collection from an text-file
>>Sure, it's just a Python module with variables in it. >> >>I wouldn't try to teach my users Python syntax though. not to mention the security risks -- http://mail.python.org/mailman/listinfo/python-list
SLUT distibution mangled?
Hi, I was trying to download and install the latest SLUT (0.9.0) from http://slut.sourceforge.net/download/index.html and it seems both the zip and the tar.gz files are corrupted - the directory "aux" and the files within can not be extracted (using windows BTW). This happened with both the zip _and_ the tar.gz file. The strange thing is: even when I'm trying to create a directory 'aux' by myself it is not possible! Anyone here ever encountered this problem? Thank you in advance, Ido Yehieli. -- http://mail.python.org/mailman/listinfo/python-list
Re: SLUT distibution mangled?
OKl, sorry this seems to have nothing to do with SLUT it self, for some reason a directory names 'aux' can not be created... most bizzare. "mkdir aux" just returns "The directory name is invalid." -- http://mail.python.org/mailman/listinfo/python-list
Re: SLUT distibution mangled?
So I can't run SLUT on windows then? -- http://mail.python.org/mailman/listinfo/python-list
Re: SLUT distibution mangled?
ok, Thanks Paul! -- http://mail.python.org/mailman/listinfo/python-list
apache mod_python problem
Hi all, I have succesfully installed apache+mod_python (ubuntu 5.10 (Breezy), libapache2-mod-python2.4 Version: 3.1.3-3ubuntu1, apache2 Version: 2.0.54-5ubuntu4, python2.4 Version: 2.4.2-1). It seems apache and everything functions fine. I tried to run the example application from the mod_python site (http://www.modpython.org/examples/psp_site.tgz) by decompressing the tgz file in a place where apache can find it, and then access it via mozilla firefox (simply http://127.0.0.1/psp_site/ where 'psp-site' is the name of the directory.) However, instead of running the index.py page like it shoud, I just get the list of files, as in: Index of /psp_site Icon NameLast modified Size Description[DIR] Parent Directory - [TXT] PyFontify.py15-Feb-2006 23:02 4.3K [DIR] images/ 15-Feb-2006 23:02- [TXT] index.py15-Feb-2006 23:02 3.4K [ ] index.pyc 15-Feb-2006 23:02 4.1K [TXT] py2html.py 15-Feb-2006 23:02 13K [DIR] styles/ 15-Feb-2006 23:02- [DIR] templates/ 15-Feb-2006 23:02- [TXT] view.py 15-Feb-2006 23:02 726 and clicking any of the .py files just opens the 'open/save' menu. The .htaccess file contains: SetHandler mod_python PythonHandler mod_python.publisher PythonDebug On everything is exactly as it is on "http://www.modpython.org/examples/";, I didn't change anything. Anyone has any idea as to what went wrong? Thank you in advance, Ido Yehieli. -- http://mail.python.org/mailman/listinfo/python-list
Re: apache mod_python problem
Thank you for your response, but I think it's not it - that didn't make any difference. -- http://mail.python.org/mailman/listinfo/python-list
Re: apache mod_python problem
Hi Graham, thank you for that link but it didn't help. I've followed the instructions, yet In the 'basic-content-handler' section, after getting to the point where it says to add this to the main Apache configuration file: AllowOverride FileInfo I replaced /some/directory with the correct directory and restarted apache2 and stilll get the same response - firwfox asks to save the response to a file. Does it matter where in the apache2 configuration file I've located these 3 lines? I've just added them at the end, just before the last line: Thank you in advance, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: apache mod_python problem
please ignore that last message, the instructions on that webpage worked, it was my fault. Thanks, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading - will threads run in parallel?
>> Also, is it possible to split off a program for the terminal that >> started it? As in I type in python test.py and test.py runs in the >> background and lets me do other things in that terminal? try: python test.py & -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for Pythonic Examples
This one is from our very own BDFL, behold- wget implemented in 7 lines of python code: import sys, urllib def reporthook(*a): print a for url in sys.argv[1:]: i = url.rfind('/') file = url[i+1:] print url, "->", file urllib.urlretrieve(url, file, reporthook) -- http://mail.python.org/mailman/listinfo/python-list
Re: (n)curses or tcl/tk?
On Feb 7, 5:35 pm, "magnate" <[EMAIL PROTECTED]> wrote: > So my question is, should I go to the trouble of learning how to make > boxes and stuff using tcl/tk, or just go with ncurses as I imagined? If you want to use curses on windows with python you need to install WCurses first. Other then that it is very portable. After you get used to it curses is also quite easy to use, however tk has a more features. Depends on what you want to do. I would have used curses in your position because it is easy to use (although tk is no rocket science either) and I like apps that can run on a terminal emulator. Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python / glade fundamentals
Hi Doug, mabe you will find it easyer to use GladeGen to generate the skeleton of your application rather then coding it yourself. Take a look here: http://www.linuxjournal.com/article/7421 Cheers, Ido Yehieli -- http://mail.python.org/mailman/listinfo/python-list
Re: Python / glade fundamentals
Hi Doug, maybe you will find it easyer to use GladeGen to generate the skeleton of your application rather then coding it yourself. Take a look here: http://www.linuxjournal.com/article/7421 Cheers, Ido Yehieli -- http://mail.python.org/mailman/listinfo/python-list
Re: Python / glade fundamentals
Franck: PyGG seems pretty cool, thanks for the link! -- http://mail.python.org/mailman/listinfo/python-list
Re: what's the general way of separating classes?
or you can write the (slightly dangerous) following: import os for file in os.listdir("/path/to/modules"): if file.endswith(".py"): exec("from "+file[:-3]+" import *") -- http://mail.python.org/mailman/listinfo/python-list