sockets

2006-01-20 Thread archana sambandam
the following code works perfectly import socket, sys s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("www.python.org", 80)) s.send("GET") while 1:    buf = s.recv(1000)    if not buf:    break    sys.stdout.write(buf) s.close() but the following code does not work  

Re: OT: excellent book on information theory

2006-01-20 Thread Juho Schultz
Bengt Richter wrote: > On Thu, 19 Jan 2006 14:12:24 +0200, Juho Schultz <[EMAIL PROTECTED]> wrote: > >>Last month I spent about an hour trying to explain why >>a*2.5e-8 = x >>raises a SyntaxError and why it should be written >>x = a*2.5e-8 >>The guy who wrote the 1st line has MSc in Physics from C

Re: Prevent Tkinter Canvas from resizing

2006-01-20 Thread Fredrik Lundh
Eric Wong wrote: > Using Tkinter, I have a Canvas with vertical Scrollbar attached. At > runtime, I dynamically create Checkboxes on the Canvas, each one on a > different row. When I add a lot of Checkboxes, instead of the > scrollbar kicking in, the Canvas resizes and subsequently, my > Applica

Re: [OT] no goto (WAS: Python code written in 1998...)

2006-01-20 Thread Hans Georg Krauthaeuser
Steven Bethard schrieb: > Carl Cerecke wrote: > >> Python has no goto. > > > Not in the standard library. You have to download the module: > http://www.entrian.com/goto/ > > ;) > > STeVe This remerbers me to VATICAL, a famous programming language from the 80s. http://www.uni-weimar.de/~m

Re: why is my hash being weird??

2006-01-20 Thread Steve Holden
pycraze wrote: > Surely adopting the above method is much better than what i have > approached earlier . The main reason i did adopt this exercise was when > i have to marshal a 20 - 40 MB above test.py file to the disk , the > simple load of the test.py will sky rocket my virtual memory > consumpt

Re: sockets

2006-01-20 Thread Fredrik Lundh
archana sambandam wrote: > the following code works perfectly > import socket, sys > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > s.connect(("www.python.org", 80)) > s.send("GET") > while 1: > buf = s.recv(1000) > if not buf: > break > sys.stdout.write(buf)

Re: Efficient implementation of deeply nested lists

2006-01-20 Thread Kay Schluehr
Bengt Richter wrote: > On 19 Jan 2006 01:19:06 -0800, "Kay Schluehr" <[EMAIL PROTECTED]> wrote: > > >I want to manipulate a deeply nested list in a generic way at a > >determined place. Given a sequence of constant objects a1, a2, ..., aN > >and a variable x. Now construct a list from them recursiv

Re: how to find not the next sibling but the 2nd sibling or findsibling "a" OR sinbling "b"

2006-01-20 Thread Steve Holden
Brett Hoerner wrote: > [EMAIL PROTECTED] wrote: [...] > "or" returns the first true element, anything but False or None, I > think... so 'food' (a string) is true, and always will return in that > code. Just in case newbies are reading: in Python several different values are considered false in t

CSV Parser and unusual (?) linesterminator - misunderstanding?

2006-01-20 Thread Tino Lange
Hi! I'm trying to use the csv Parser included with Python. Field Delimiter is "|", Line Delimiter is "#". Unfortunately it doesn't work as expected. The parser seems to just ignore the 'lineterminator'? Here's some example: > $ cat test.py > #! /usr/bin/env python > > import sys, csv, cStringIO

Re: Python Developer positions (2) in Campbell, CA

2006-01-20 Thread Steve Holden
Martha: Please see http://www.python.org/Jobs.html http://www.python.org/Jobs-howto.html to find out about the Python Jobs Board, which may be (even) more useful than posting (or looking, for job seekers) on the Python list. regards Steve Marsha Hoyt wrote: > Hi Python fans, > > >

Re: add pexpect to the standard library, standard "install" mechanism.

2006-01-20 Thread Nick Craig-Wood
Robert Kern <[EMAIL PROTECTED]> wrote: > Installing Pexpect > > The pexpect-current.tgz tarball is a standard Python Distutil distribution. > > 1. download pexpect-current.tgz > 2. tar zxf pexpect-current.tgz > 3. cd pexpect-current > 4. python setup.py install If on linux you

Re: CSV Parser and unusual (?) linesterminator - misunderstanding?

2006-01-20 Thread Peter Otten
Tino Lange wrote: > I'm trying to use the csv Parser included with Python. Field Delimiter is > "|", Line Delimiter is "#". Unfortunately it doesn't work as expected. The > parser seems to just ignore the 'lineterminator'? The csv reader accepts '\r' '\r\n' or '\n' as line endings, even mixed in

Re: CSV Parser and unusual (?) linesterminator - misunderstanding?

2006-01-20 Thread Peter Otten
Peter Otten wrote: > memfile = (s + "\n" for s in "1a|1b|1c|1d#2a|2b|2c|2d#3a|3b|3c > 3d#".split("#") if s) I just found out that you need not add "\n" to the line. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehention

2006-01-20 Thread Duncan Booth
Mathijs wrote: > Python beginner here and very much enjoying it. I'm looking for a > pythonic way to find how many listmembers are also present in a > reference list. Don't count duplicates (eg. if you already found a > matching member in the ref list, you can't use the ref member > anymore). >

ANN: Veusz 0.9, a scientific plotting package

2006-01-20 Thread Jeremy Sanders
Veusz 0.9 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2006 Jeremy Sanders <[EMAIL PROTECTED]> Licenced under the GPL (version 2 or greater) Veusz is a scientific plotting package written in Python. It uses PyQt for d

Re: [ANNOUNCE] MyHDL 0.5 released

2006-01-20 Thread Jan Decaluwe
Michael wrote: > Jan Decaluwe wrote: > > >>I'm pleased to announce the release of MyHDL 0.5. >> >>MyHDL is an open-source package for using Python as a hardware >>description and verification language. Moreover, it can convert >>a design to Verilog. Thus, MyHDL provides a complete path >>from Pyt

Re: Multiple modules with database access + general app design?

2006-01-20 Thread Daniel Dittmar
Frank Millman wrote: > I have subclassed threading.Thread, and I store a number of attributes > within the subclass that are local to the thread. It seems to work > fine, but according to what you say (and according to the Python docs, > otherwise why would there be a 'Local' class) there must be s

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Steve Holden
Debashis Dey wrote: > Hello, > > I have a python CGI program. I would like to show a graph within a HTML > plage. I would like to dynamically generate the graph using the python > CGI script on the web server side and send it to the browser. > > My question is how can I do this in python? Is

Re: CSV Parser and unusual (?) linesterminator - misunderstanding?

2006-01-20 Thread Tino Lange
Peter Otten wrote: > Tino Lange wrote: > >> I'm trying to use the csv Parser included with Python. Field Delimiter is >> "|", Line Delimiter is "#". Unfortunately it doesn't work as expected. >> The parser seems to just ignore the 'lineterminator'? > > The csv reader accepts '\r' '\r\n' or '\n'

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Xavier Morel
Steve Holden wrote: > Debashis Dey wrote: >> Hello, >> >> I have a python CGI program. I would like to show a graph within a HTML >> plage. I would like to dynamically generate the graph using the python >> CGI script on the web server side and send it to the browser. >> >> My question is how

DB API and thread safety

2006-01-20 Thread Robin Haswell
Hey guys I've been reading http://www.python.org/peps/pep-0249.html and I don't quite get what level of thread safety I need for my DB connections. If I call db = FOOdb::connect() at the start of my app, and then every thread does it's own c = db.cursor() at the top, what level of thread safety d

Re: OT: excellent book on information theory

2006-01-20 Thread Anton Vredegoor
Terry Hancock wrote: > On 19 Jan 2006 13:57:06 +0100 > Anton Vredegoor <[EMAIL PROTECTED]> wrote: > > Some time ago I tried to 'sell' Python to a mathematician. > > The crucial point was that it was not (in standard Python) > > possible to have a matrix A and a matrix B and then do for > > example

Re: Is the Python binding for ncurses unicode capable?

2006-01-20 Thread Thomas Dickey
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Thomas Dickey wrote: >>>ncurses expects byte strings (although I'm uncertain as to what >>>impact multi-byte encodings have in ncurses). >> >> >> It depends on whether python's curses binding is linked with the >> wide-character >> flavor (ncursesw)

Re: CSV Parser and unusual (?) linesterminator - misunderstanding?

2006-01-20 Thread skip
Tino> Is this going to be changed? Is someone working on it? Or are Tino> patches for SF wanted? A patch that removes this constraint would be helpful. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: CSV Parser and unusual (?) linesterminator - misunderstanding?

2006-01-20 Thread Peter Otten
Tino Lange wrote: >>> I'm trying to use the csv Parser included with Python. Field Delimiter >>> is "|", Line Delimiter is "#". Unfortunately it doesn't work as >>> expected. The parser seems to just ignore the 'lineterminator'? >> >> The csv reader accepts '\r' '\r\n' or '\n' as line endings, ev

Re: list(...) and list comprehensions (WAS: Arithmetic sequences in Python)

2006-01-20 Thread Antoon Pardon
Op 2006-01-18, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: > Giovanni Bajo schrieb: >> Diez B. Roggisch wrote: >> due to the nested parentheses. Note that replacing list comprehensions with list(...) doesn't introduce any nested parentheses; it basically just replaces brackets wi

Re: DB API and thread safety

2006-01-20 Thread Matt Goodall
Robin Haswell wrote: > Hey guys > > I've been reading http://www.python.org/peps/pep-0249.html and I don't > quite get what level of thread safety I need for my DB connections. > > If I call db = FOOdb::connect() at the start of my app, and then every > thread does it's own c = db.cursor() at the

Re: Sudoku solver: reduction + brute force

2006-01-20 Thread Anton Vredegoor
ago wrote: [Something I mostly agree with] > According to Anton the number of possible solutions can be reduced > using 1) number swapping, 2) mirroring, 3) blocks/rows/columns > swapping. All those operations create equivalent matrices. For a 9X9 > grid, this should give a reduction factor = (9

Re: simple pythonpath query

2006-01-20 Thread Twig
"Tim Golden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | [EMAIL PROTECTED] | || I've downloaded the hypertext module and put it in the | c:\python24\lib || folder. I would have thought that since the lib directory is in the || Pythonpath,I would be able to import python scripts

Re: Looking for standalone Python

2006-01-20 Thread Twig
"Twig" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Szabolcs Nagy wrote: | >>Is this possible? | > | > yes: movable python | > http://www.voidspace.org.uk/python/movpy/introduction.html | > | | Thanks! Also found this: | | http://arctrix.com/nas/python/standalone.html BTW, Wou

Re: Multiple modules with database access + general app design?

2006-01-20 Thread Frank Millman
Daniel Dittmar wrote: > Frank Millman wrote: > > I have subclassed threading.Thread, and I store a number of attributes > > within the subclass that are local to the thread. It seems to work > > fine, but according to what you say (and according to the Python docs, > > otherwise why would there be

Re: Looking for standalone Python

2006-01-20 Thread Fredrik Lundh
Twig wrote: > Would it work if I just install Python locally (yes, Win..) and copy the > files to shared dir/drive? absolutely. 1) do a local install to, say, c:\python24 2) check if the python DLL (python24.dll) was installed along the python.exe file in that directory. if not, copy it from \

Finding the relative path of a file from a dir

2006-01-20 Thread Suresh Jeevanandam
Hi, a = '/home/suresh/doc/html/a1/' b = '/home/suresh/doc/' I am looking for a standard function which will return the location of b relative to a i.e. '../..' I have gone through the os and os.path modules, but could not find any function of use. Should I write my own?

Re: Problem with FTPLib and incomplete files on some downloads

2006-01-20 Thread BJ Swope
Just guessing but are the files binary yet you are downloading them without declaring binary?On 1/16/06, Peter A.Schott < [EMAIL PROTECTED]> wrote:I download a lot of 4-6 KB files and regularly run into issues with files that don't get downloaded all the way or otherwise get corrupt.I do something

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Magnus Lycka
Claudio Grondi wrote: > You seem here to try to give a definition of the term 'value' for > Python. If I understand it right, the definition of the term can't be > generally given for many reasons. It depends at least on type and in > advanced usage it can be arbitrary defined or changed. > That

Re: Finding the relative path of a file from a dir

2006-01-20 Thread utabintarbo
http://groups.google.com/group/comp.lang.python/browse_thread/thread/390d8d3e3ac8ef44/d8c74f96468c6a36?q=relative+path&rnum=1#d8c74f96468c6a36 -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the relative path of a file from a dir

2006-01-20 Thread Peter Hansen
Suresh Jeevanandam wrote: > a = '/home/suresh/doc/html/a1/' > b = '/home/suresh/doc/' > > I am looking for a standard function which will return the location of b > relative to a i.e. '../..' > > I have gone through the os and os.path modules, but could not find any > function

Re: Finding the relative path of a file from a dir

2006-01-20 Thread Kent Johnson
Suresh Jeevanandam wrote: > Hi, > a = '/home/suresh/doc/html/a1/' > b = '/home/suresh/doc/' > > I am looking for a standard function which will return the location of b > relative to a i.e. '../..' Jason Orendorff's path module has a method for this (relpathto()). http://www.jorendorff.c

Howto create this XML string?

2006-01-20 Thread Sbaush
I have a xml tree like this tree = ET.ElementTree(root) How can i put tree in a string?tree is generated like this:import elementtree.ElementTree as ET root = ET.Element("manager") req=ET.SubElement(root,"request")app=ET.SubElement(req,"append") app.set("mode","INPUT")met=ET.SubElement(app,"m

Re: Finding the relative path of a file from a dir

2006-01-20 Thread Fuzzyman
pathutils has a function to do this (actually extracted from the path module). http://www.voidspace.org.uk/python/pathutils.html All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

Re: DB API and thread safety

2006-01-20 Thread Daniel Dittmar
Robin Haswell wrote: > Hey guys > > I've been reading http://www.python.org/peps/pep-0249.html and I don't > quite get what level of thread safety I need for my DB connections. > > If I call db = FOOdb::connect() at the start of my app, and then every > thread does it's own c = db.cursor() at the

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Luiz Geron
I don't have experience on this, but I think that you can make the script return the image "contents" directly to the img tag, without passing it to a img file, so you can use something like this: wich saves some processing and I/O. -- http://mail.python.org/mailman/listinfo/python-list

OT: introduction to computing clusters?

2006-01-20 Thread skip
Sorry for the off-topic post, but I know of no better collection of brains than this one. I'm starting to investigate clustering as a means to address some growing computing needs at work, but know essentially zip about the concept. If you know of a good introduction to computing clusters (Linux

Re: Being unjust

2006-01-20 Thread Magnus Lycka
Fredrik Lundh wrote: > if you can find one that's relatively stable, simple enough to enable > beginners to > do simple things with just a little python code, can do simple stuff without > needing > a full-blown DB, and can run as an ordinary CGI if necessary, I'm definitely > +1. > > (hmm. ma

Simultaneous connections

2006-01-20 Thread datbenik
How can i write a program that supports simultaneous multipart download. So i want to open multiple connections to download one file. Is this possible. If so, how? -- http://mail.python.org/mailman/listinfo/python-list

Re: Simultaneous connections

2006-01-20 Thread Jean-Paul Calderone
On 20 Jan 2006 06:01:15 -0800, datbenik <[EMAIL PROTECTED]> wrote: >How can i write a program that supports simultaneous multipart >download. So i want to open multiple connections to download one file. >Is this possible. If so, how? http://twistedmatrix.com/ > >-- >http://mail.python.org/mailman

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Max Erickson
Sparklines is a script that does exactly what you are asking using python and PIL: http://bitworking.org/projects/sparklines/ max -- http://mail.python.org/mailman/listinfo/python-list

Re: Howto create this XML string?

2006-01-20 Thread Fredrik Lundh
Sbaush wrote: > Is possible to have the XML in a string (for example xmlstring) and for > printing do a print xmlstring ? most about anything that can be written to a file can be written to a string using the StringIO module: http://www.effbot.org/librarybook/stringio.htm file = StringI

Using freeze or other application to create linkable dynamic libraries for c++ applications?

2006-01-20 Thread Geoff Wedig
Is it possible to create a DLL (pr on unix a .a, .so, etc) from python code, perhaps using freeze or some other application? Freeze seems to assume that it's creating the main program body, but I don't really understand it well enough to say. If it doesn't work, is there another application th

accessing hardware information using python

2006-01-20 Thread Johhny
Hello, I am currently looking to write a utility in python that will monitor the statis of a RAID card within linux. The card in Question is the LSI SAS1064 as the tools provided by the vendor to monitor the software does not suit our requirements. However I am unsure how to convert dmidecode inf

Re: Looking for standalone Python

2006-01-20 Thread Twig
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Twig wrote: | | > Would it work if I just install Python locally (yes, Win..) and copy the | > files to shared dir/drive? | | absolutely. | | 1) do a local install to, say, c:\python24 | | 2) check if the python DLL (p

Re: Simultaneous connections

2006-01-20 Thread datbenik
So this isn't possible with the urllib or with the urllib2? -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Introduction to Event-Driven Programming

2006-01-20 Thread Randall Parker
Steve, This is an aside: I'd love to see someone implement in Python a framework similar to the Quantum Leaps Quantum Framework for event-driven programming. I think Python has some features that lend themselves to a neater implementation than what can be done in C/C++. More generally, I'd like t

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Steve Holden
Luiz Geron wrote: > I don't have experience on this, but I think that you can make the > script return the image "contents" directly to the img tag, without > passing it to a img file, so you can use something like this: > > > > wich saves some processing and I/O. > No it doesn't, because the s

Re: MyHDL 0.5 released

2006-01-20 Thread Randall Parker
Jan, What do you see as the main advantage for using MyHDL rather than VHDL for coding up a chip design? -- http://mail.python.org/mailman/listinfo/python-list

Re: Howto create this XML string?

2006-01-20 Thread Sbaush
in the elementtree implementation the tostring function doesn't work with a tree, work only with an element. What is the way to put the tree in a string?2006/1/20, Fredrik Lundh < [EMAIL PROTECTED]>:Sbaush wrote:> Is possible to have the XML in a string (for example xmlstring) and for > printing do

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Xavier Morel
Steve Holden wrote: > Luiz Geron wrote: >> I don't have experience on this, but I think that you can make the >> script return the image "contents" directly to the img tag, without >> passing it to a img file, so you can use something like this: >> >> >> >> wich saves some processing and I/O. >> >

Concurrency, I guess

2006-01-20 Thread David S.
I have a simple intranet web app whose job is to synchronize a couple of databases. The web part is that you can change settings such as how often the sync should happen, force the sync, or see the log. Since it runs periodically, I want the process that does the db sync to run happily along but

Redirecting standard out in a single namespace

2006-01-20 Thread Fuzzyman
Hello, I'm trying to redirect standard out in a single namespace. I can replace sys.stdout with a custom object - but that affects all namespaces. There will be code running simultaneously that could import sys afterwards - so I don't want to make the change in the sys module. I have an idea to

ANN: FreeImagePy 1.2.0

2006-01-20 Thread Michele Petrazzo
FreeImagePy 1.2.0 is available at freeimagepy.sf.net What is? It' a python wrapper for FreeImage, Open Source library for developers who would like to support popular graphics image formats. How work? It use a binary freeimage library present on the system and ctypes. Major changes fro

Re: OT: introduction to computing clusters?

2006-01-20 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >Sorry for the off-topic post, but I know of no better collection of brains >than this one. I'm starting to investigate clustering as a means to address >some growing computing needs at work, but know essentially zip about the >concept.

Re: Howto create this XML string?

2006-01-20 Thread Fredrik Lundh
"Sbaush" wrote: > in the elementtree implementation the tostring function doesn't work with a > tree, work only with an element. What is the way to put the tree in a > string? this is the code you posted: root = ET.Element("manager") ... snip ... tree = ET.ElementTree(root) tree

Re: list(...) and list comprehensions (WAS: Arithmetic sequences in Python)

2006-01-20 Thread Rocco Moretti
Antoon Pardon wrote: > Well we could have list(a) return [a], and have a list_from_iterable. > Although I would prefer a different name. Or reverse it - list() always takes a single iterable, and list_from_scalars() is defined something like follows: >>> def list_from_scalars(*args): retu

Re: How to generate graphics dynamically on the web using PythonCGI script?

2006-01-20 Thread Fredrik Lundh
Xavier Morel wrote: > Generate inline base64 encoded images in your HTML page and you're done. > (yes, this is ugly, especially if you have a browser that don't support data: urls. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread David Wahler
Xavier Morel wrote: > Steve Holden wrote: > > Luiz Geron wrote: > >> I don't have experience on this, but I think that you can make the > >> script return the image "contents" directly to the img tag, without > >> passing it to a img file, so you can use something like this: > >> > >> > >> > >> wi

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Claudio Grondi
Magnus Lycka wrote: > Claudio Grondi wrote: > >> You seem here to try to give a definition of the term 'value' for >> Python. If I understand it right, the definition of the term can't be >> generally given for many reasons. It depends at least on type and in >> advanced usage it can be arbitra

Re: Concurrency, I guess

2006-01-20 Thread dtecmeister
Sometimes creating files and separate processes are all that's needed. Write the settings into a config file with the web process and read them from the file with the sync process. Then create a second file at the start of the process and delete it once the process is complete. Lastly run a proced

Re: using arrow keys in the python shell on Mac OS X

2006-01-20 Thread [EMAIL PROTECTED]
You need libreadline to make it work. For some stupid reason OSX doesnt come with it installed. just get the gzipped one from here: http://www.pycs.net/bbum/2004/1/21/readline.so.gz then gunzip it and put the readline.so into /Library/Python/2.3/site-packages/ then fire up python again and it s

Bittorrent RPM Dependency Problem

2006-01-20 Thread Mark Sargent
Hi All, tried to install the RPM for bittorrent, and got the following, [EMAIL PROTECTED] bittorrent]# rpm -Uvh BitTorrent-4.2.2-1-Python2.3.noarch.rpm error: Failed dependencies: python(abi) = 2.3 is needed by BitTorrent-4.2.2-1.noarch [EMAIL PROTECTED] bittorrent]# python -V Python 2.3.4 why

Firefox bug in webbrowser module on Ubuntu?!

2006-01-20 Thread SPE - Stani's Python Editor
Hi, During optimizing SPE for Ubuntu, I found something strange. I have Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not working: >>> import webbrowser >>> webbrowser.open("http://www.python.org";) It does not throw an exception, but is not able to launch a browser. Ubuntu shi

zipfile and file permissions

2006-01-20 Thread Pete Forman
I'm trying to move the building of a zip file from a shell script into python. It is mostly working but when I unzip the files the UNIX permissions are not preserved. The zip program I've been using is the standard(?) one on Linux, from Info-Zip. Presumably I need to do something with external_a

Re: zipfile and file permissions

2006-01-20 Thread Robert Kern
Pete Forman wrote: > I'm trying to move the building of a zip file from a shell script into > python. It is mostly working but when I unzip the files the UNIX > permissions are not preserved. The zip program I've been using is the > standard(?) one on Linux, from Info-Zip. Presumably I need to d

Problem with running external process

2006-01-20 Thread ToMasz
There is a script running continuously which executes an external script in a loop using os.spawnlp(os.P_WAIT, 'extscript.py') function. After several hundred executions (cycles of the loop), the main script gets an exception while trying to start the process. This situation is repeated until the m

Xah's Edu Corner: IT Industry Predicament

2006-01-20 Thread Xah Lee
IT Industry Predicament Xah Lee, 200207 As most of you agree, there are incredible wrongs in software industry. Programs crash, injurious tools, uninformed programers, and decrepit education system. Over the years of my computing industry experience since 1995, i have recently gradually come to r

Re: Xah's Edu Corner: IT Industry Predicament

2006-01-20 Thread Ulrich Hobelmann
Xah Lee wrote: > • The reason fucking languages like C and family mask technically Contrary to popular opinion, languages don't multiply. Certainly they don't have sex. Most (human) languages merely have something called gender, and words don't interact. C has a bastard child called C++, tru

Re: accessing hardware information using python

2006-01-20 Thread [EMAIL PROTECTED]
Johhny wrote: > I am currently looking to write a utility in python that will monitor > the statis of a RAID card within linux. The card in Question is the LSI > SAS1064 as the tools provided by the vendor to monitor the software > does not suit our requirements. What are your requirements? > How

Re: Redirecting standard out in a single namespace

2006-01-20 Thread Farshid Lashkari
Fuzzyman wrote: > Is there another way to shadow the sys module from a single namespace ? I've never actually tried this, but try making a copy of the sys module then replacing the stdout object with your own object. Then you can replace "sys" of the namespace with your custom "sys" module. I gu

Re: MyHDL 0.5 released

2006-01-20 Thread Jan Decaluwe
Randall Parker wrote: > Jan, > > What do you see as the main advantage for using MyHDL rather than VHDL > for coding up a chip design? The fact that MyHDL is technically just another Python application. So it makes all typical Python advantages available to hardware designers. No need to discuss

PyXML: SAX vs. DOM

2006-01-20 Thread Matthias Kaeppler
Hi, I have to say I am confused about the documentation on pyxml.sf.net. When I want to use DOM, I effectively am using a class called Sax2? ^^ I also have to catch SAXExceptions, which reside in xml.sax._exceptions. I thought DOM and SAX are two completely different things. Why is PyXML mixing

Re: PyXML: SAX vs. DOM

2006-01-20 Thread Matthias Kaeppler
Oh and: Where can I find an API reference for PyXML? Am I supposed to /guess/ which methods and attributes e.g. Sax2 supplies? :D Thanks again, Matthias -- http://mail.python.org/mailman/listinfo/python-list

Re: add pexpect to the standard library, standard "install" mechanism.

2006-01-20 Thread funkyj
Yeah, going back to the sourceforge site now I see the install instructions you quote above. Perhaps I'm spoiled by all the FSF packages I've dealt with over the years. In addition to being impatient I expect the README file to either tell me how to install the product or direct me to the INSTALL

Re: PyXML: SAX vs. DOM

2006-01-20 Thread Steven Bethard
Matthias Kaeppler wrote: > I have to say I am confused about the documentation on pyxml.sf.net. > When I want to use DOM, I effectively am using a class called Sax2? ^^ > I also have to catch SAXExceptions, which reside in xml.sax._exceptions. > > I thought DOM and SAX are two completely different

Re: Xah's Edu Corner: IT Industry Predicament

2006-01-20 Thread Keith Thompson
"Xah Lee" <[EMAIL PROTECTED]> writes: [the usual] ___ /| /| | | ||__|| | Please do | / O O\__ NOT | /

Extended List Comprehension

2006-01-20 Thread James Stroud
Would anyone else find this syntax useful for generator expressions? py> [x for x in '1234' if x%2 else 'even'] [1, 'even', 3, 'even'] I'm guessing this has been suggested before? James -- http://mail.python.org/mailman/listinfo/python-list

Re: PyXML: SAX vs. DOM

2006-01-20 Thread Matthias Kaeppler
Steven Bethard wrote: > I don't have an answer to your real question, but if you're not > committed to a particular XML package yet, you might consider ElementTree: > http://effbot.org/zone/element-index.htm > > The API is much simpler, and the package has a much more sane > organization. ;)

Re: Extended List Comprehension

2006-01-20 Thread Paul Rubin
James Stroud <[EMAIL PROTECTED]> writes: > py> [x for x in '1234' if x%2 else 'even'] > [1, 'even', 3, 'even'] > > I'm guessing this has been suggested before? You could (in 2.5) use: [(x if x%2 else 'even') for x in '1234'] -- http://mail.python.org/mailman/listinfo/python-list

Re: Extended List Comprehension

2006-01-20 Thread James Stroud
James Stroud wrote: > Would anyone else find this syntax useful for generator expressions? > > py> [x for x in '1234' if x%2 else 'even'] > [1, 'even', 3, 'even'] > > I'm guessing this has been suggested before? > > James Before anyone notices, I should say: [x for x in [1,2,3,4] if x%2 else '

Re: Extended List Comprehension

2006-01-20 Thread Tim Chase
>>py> [x for x in '1234' if x%2 else 'even'] >>[1, 'even', 3, 'even'] >> >>I'm guessing this has been suggested before? > > > You could (in 2.5) use: > >[(x if x%2 else 'even') for x in '1234'] This failed on multiple levels in 2.3.5 (the "if" syntax is unrecognized, and trying the below w

Re: Extended List Comprehension

2006-01-20 Thread Ido Yehieli
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: Extended List Comprehension

2006-01-20 Thread Joel Bender
> You could (in 2.5) use: > >[(x if x%2 else 'even') for x in '1234'] Or this: [int(x)&1 and x or 'even' for x in '1234'] -- http://mail.python.org/mailman/listinfo/python-list

Re: Extended List Comprehension

2006-01-20 Thread Paul Rubin
Tim Chase <[EMAIL PROTECTED]> writes: > > You could (in 2.5) use: > >[(x if x%2 else 'even') for x in '1234'] > > This failed on multiple levels in 2.3.5 (the "if" syntax is > unrecognized, Yes, that syntax is new to 2.5. > However, this worked in my 2.3.5: > [((x%2 == 0 and 'even') or x

Re: Redirecting standard out in a single namespace

2006-01-20 Thread Ido Yehieli
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 differe

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Bryan Olson
Roy Smith wrote: > [EMAIL PROTECTED] wrote: > > >>I have a regular expression that is approximately 100k bytes. (It is >>basically a list of all known norwegian postal numbers and the >>corresponding place with | in between. I know this is not the intended >>use for regular expressions, but it s

Strange python behavior with modules on an emt64 box

2006-01-20 Thread Joshua Luben
I thought I would post this here first before seeking more experienced ears for this particular strangness.   I have Python 2.4.2 installed from source on a dual processor dell server. These are x86_64 processors (verified by /bin/arch) (aka emt64 extensions).   uname -a gives Linux eps-li

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Bryan Olson <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > [EMAIL PROTECTED] wrote: > > > > > >>I have a regular expression that is approximately 100k bytes. (It is > >>basically a list of all known norwegian postal numbers and the > >>corresponding place wit

python & camera

2006-01-20 Thread Alex Gittens
I'm working on a final project for my EE degree that requires the use of digital camera with high resolution. I'd like to do the image capture with Python, preferably in a cross-platform manner, but if necessary, we can limit ourselves to Windows. Any ideas on modules/hardware for doing this? Than

Re: list comprehention

2006-01-20 Thread Bryan Olson
Duncan Booth wrote: > Here's the way I would do it: > def occurrences(it): > > res = {} > for item in it: > if item in res: > res[item] += 1 > else: > res[item] = 1 > return res I slightly prefer: def occurrences(it): res = {} re

Re: Arithmetic sequences in Python

2006-01-20 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > How would you make a one-element list, which we'd currently write as [3]? > > Would you have to say list((3,))? > > Yep. I don't particularly like the "mandatory trailing comma" in the > tuple's display form, mind you, but, if it's good enough for tup

Re: python & camera

2006-01-20 Thread Claudio Grondi
Alex Gittens wrote: > I'm working on a final project for my EE degree that requires the use > of digital camera with high resolution. I'd like to do the image > capture with Python, preferably in a cross-platform manner, but if > necessary, we can limit ourselves to Windows. Any ideas on > modules/

Re: Is the Python binding for ncurses unicode capable?

2006-01-20 Thread bmcnally
Can someone explain what I'm doing wrong? The following code snipet produces an error about addch() expecting an int: u = u'\u2591' s = u.encode("UTF-8") stdscr.addch((y+1), (x+1), s, curses.color_pair(1)) If I try this instead: u = u'\u2591' s = u.encode(

  1   2   >