Re: XML-schema 'best practice' question

2008-09-19 Thread Frank Millman
On Sep 18, 8:28 am, Frank Millman <[EMAIL PROTECTED]> wrote: > Hi all > > This is not strictly a Python question, but as I am writing in Python, > and as I know there are some XML gurus on this list, I hope it is > appropriate here. > > XML-schemas are used to define the structure of an xml documen

Enjoy seeing Enjoy seeingEnjoy seeingEnjoy seeing Enjoy seeing

2008-09-19 Thread [EMAIL PROTECTED]
Enjoy seeing with new video pictures http://nagaaraja.blogspots.com\ -- http://mail.python.org/mailman/listinfo/python-list

Re: migrating processess to avoid the GIL

2008-09-19 Thread Aaron "Castironpi" Brady
On Sep 19, 6:40 pm, "Patrick Stinson" <[EMAIL PROTECTED]> wrote: > I need to migrate calls to CPython to another process in my C++ app to > get around the GIL. Does anyone know of a good way to do this on > windows and Mac? All calls and callbacks can be blocking, I just need > to share some data s

Re: Installing pySerial

2008-09-19 Thread eliben
On Sep 18, 6:01 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > Joe G (Home) wrote: > > Hi All, > > > Background > > === > > I have installed Python for windows today from the python web site  .I also > > installed pySerial using the Windows installer from the sourceforge web > > site..

report a BUG of package setuptools-0.6c8.

2008-09-19 Thread 为爱而生
Traceback (most recent call last): File "setup.py", line 176, in main() File "setup.py", line 172, in main setup(**args) File "/usr/lib/python2.5/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.5/distutils/dist.py", line 974, in run_commands

Re: Deflate with urllib2...

2008-09-19 Thread Sam
Gabriel... Awesome! Thank you so much for the solution. And yeah, I found exactly one website that strangely enough only does deflate, not gzip. I'd rather not say what website it is, since it's small and not mine. They may be few and in between, but they do exist. Thanks On Sep 19, 3:48 am

Re: dict generator question

2008-09-19 Thread bearophileHUGS
MRAB: > except that it could be misleading when: > len(file(path)) > returns the number of lines and /not/ the length in bytes as you might > first think! :-) Well, file(...) returns an iterable of lines, so its len is the number of lines :-) I think I am able to always remember this fact. >

Re: Out of memory issue with dialog box

2008-09-19 Thread Gabriel Genellina
En Thu, 18 Sep 2008 13:32:32 -0300, <[EMAIL PROTECTED]> escribió: We have a mutilthreaded process in which one of the threads uses too much memory causing the process to run out of memory. However when this happens we see a dialog box pop up with the message "fatal error in GC : too many heap se

Re: dict generator question

2008-09-19 Thread Steven D'Aprano
On Fri, 19 Sep 2008 17:00:56 -0700, MRAB wrote: > Extending len() to support iterables sounds like a good idea, except > that it could be misleading when: > > len(file(path)) > > returns the number of lines and /not/ the length in bytes as you might > first think! Extending len() to support

Re: dict generator question

2008-09-19 Thread MRAB
On Sep 19, 2:01 pm, [EMAIL PROTECTED] wrote: > Gerard flanagan: > > > data.sort() > > datadict = \ > > dict((k, len(list(g))) for k,g in groupby(data, lambda s: > >      '.'.join(s.split('.',2)[:2]))) > > That code may run correctly, but it's quite unreadable, while good > Python programmers value

Re: Pexpect echoes twice for each read

2008-09-19 Thread RDarrelBonner
On Sep 9, 4:01 pm, "Sriram Rajan" <[EMAIL PROTECTED]> wrote: > For some reason, Using pexpect causes my output to echo twice when I > connect from my MAC Darwin (10.4) to Linux (CentOS release 5 ): > > The program: > - > #!/usr/bin/python > # Automatic scp to remote host > # Inp

migrating processess to avoid the GIL

2008-09-19 Thread Patrick Stinson
I need to migrate calls to CPython to another process in my C++ app to get around the GIL. Does anyone know of a good way to do this on windows and Mac? All calls and callbacks can be blocking, I just need to share some data structures. Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: curses.setsyx()?

2008-09-19 Thread linkmaster032000
On Sep 19, 1:24 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > >I tried curses.setsyx(2,3) in my script and it doesn't move the curses > >cursor. Any alternatives/solutions? > > Did you call doupdate after?  setsyx just manipulates the data structures. > It takes a call t

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread Michael Palmer
On Sep 18, 5:33 pm, erikcw <[EMAIL PROTECTED]> wrote: > Hi, > > I have a cgi script where users are uploading large files for > processing. I want to launch a subprocess to process the file so the > user doesn't have to wait for the page to load. > > What is the correct way to launch subprocess wi

ScrolledCanvas/ScrolledText

2008-09-19 Thread lekin2
So what the heck is going on. I have a Pmw.ScrollingCanvas and inside I put a Pmw.ScrollingText and that all works but I can't get it to scroll. I was thinking I needed an event like: self.sc = Pmw.ScrolledCanvas(parent, borderframe = 5, labelpos = 'n',

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread Gary Herron
Almar Klein wrote: Ah, no, that's a different thing. If the parent exits, the child will also be killed I believe. Not if it's stuck in some endless loop... If you want to spawn a process and have it live on independent of the parent, you want to make the child process a "daem

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread Marco Bizzarri
On Fri, Sep 19, 2008 at 10:48 PM, Almar Klein <[EMAIL PROTECTED]> wrote: >> Ah, no, that's a different thing. If the parent exits, the child will >> also be killed I believe. > > Not if it's stuck in some endless loop... > >> If you want to spawn a process and have it live on independent of the >>

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread Almar Klein
> > Ah, no, that's a different thing. If the parent exits, the child will > also be killed I believe. Not if it's stuck in some endless loop... If you want to spawn a process and have it live on independent of the > parent, you want to make the child process a "daemon", detatching > itself from

Re: Python newbie

2008-09-19 Thread bearophileHUGS
Mladen Gogala: Welcome to Python, you will need only one or few weeks to be able to write useful Python programs. But even with the help of a good book (that I suggest you to read) you may need several months or one year to master it :-) > 2) Why is it illegal to pass a built-in function "print"

Re: Problem with Python shell through Cygwin Screen (Python/Vim/Screen combo)

2008-09-19 Thread Jason Tishler
Ant, On Fri, Sep 19, 2008 at 03:10:10AM -0700, Ant wrote: > [snip] > This works great in Linux, and also in Windows using the Cygwin build > of Python, but when you call: > > screen -S py -s python > > using the Windows build of Python, the shell just hangs. Does anyone > know if this is a known i

Re: improving a huge double-for cycle

2008-09-19 Thread Terry Reedy
Gabriel Genellina wrote: En Fri, 19 Sep 2008 02:11:51 -0300, Tino Wildenhain <[EMAIL PROTECTED]> escribió: Also I never saw a list where the threading often goes wrong like this here - is there any special setup or is it just peoples MUA which screws up? Perhaps it's due to the newsgroup/lis

Re: improving a huge double-for cycle

2008-09-19 Thread pruebauno
On Sep 18, 7:42 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 18 Sep 2008 20:43:00 +0200, Bruno Desthuilliers wrote: > > Now the obvious winner is pruebono - even unoptimized, using sets seems > > to be *way* faster than even the most optimized corrected version of > >

Re: improving a huge double-for cycle

2008-09-19 Thread Harald Luessen
On Thu, 18 Sep 2008 Bruno Desthuilliers wrote: ># Harald : uncomment this and run test_results. As far as I can tell, it ># doesn't yields the expected results > >## IN7 = IN[:] >## def sortk7(n): >## return n.coordinates[0] > >## def doubles7(): >## "is ordering better ? - Nope Sir, it's

Re: generator exceptions

2008-09-19 Thread Gabriel Genellina
En Fri, 19 Sep 2008 10:40:00 -0300, Alexandru Mosoi <[EMAIL PROTECTED]> escribió: i have a generator that raises an exception when calling next(), however if I try to catch the exception and print the traceback i get only the line where next() was called while True: try: iterator.next(

Re: Multimapping and string converting

2008-09-19 Thread Gabriel Genellina
En Fri, 19 Sep 2008 10:59:26 -0300, Ron Brennan <[EMAIL PROTECTED]> escribió: Hello, I have a multimap dictionary with a 1 Key to N values. I want to convert the N values to a string to be used elsewhere in my program. So I have dict[(1,[1, 2 ,3 ,4])] which I have sorted When I do a print

Re: improving a huge double-for cycle

2008-09-19 Thread giltay
On Sep 18, 7:42 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I'm not being snarky about losing priority here, but I submitted > essentially the same solution two hours earlier than pruebono. My apologies (seriosuly). In this case, I think it might just be haste. For what i

Re: Python newbie

2008-09-19 Thread Peter Pearson
On 19 Sep 2008 08:13:05 GMT, Steven D'Aprano wrote: > On Fri, 19 Sep 2008 09:13:48 +0200, Mladen Gogala wrote: [snip] >> perl -e '@a=(1,2,3); map { $_*=2 } @a; map { print "$_\n"; } @a;' >> >> The equivalent in Python looks like this: > > Actually, no it doesn't. The equivalent looks more like th

Re: Deflate with urllib2... (solved)

2008-09-19 Thread Gabriel Genellina
En Thu, 18 Sep 2008 23:29:30 -0300, Sam <[EMAIL PROTECTED]> escribió: On Sep 18, 2:10 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Tue, 16 Sep 2008 21:58:31 -0300, Sam <[EMAIL PROTECTED]> escribió: The code is correct - try with another server. I tested it with a   LightHTTPd server an

Re: SMTP via GMAIL

2008-09-19 Thread Grant Edwards
On 2008-09-19, Steve Holden <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2008-09-18, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >>> In message >>> <[EMAIL PROTECTED]>, sui >>> wrote: >>> Traceback (most recent call last): File "mail5.py", line 21, in session = s

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread r0g
erikcw wrote: > Hi, > > I have a cgi script where users are uploading large files for > processing. I want to launch a subprocess to process the file so the > user doesn't have to wait for the page to load. > > What is the correct way to launch subprocess without waiting for the > result to retu

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread r0g
erikcw wrote: > Hi, > > I have a cgi script where users are uploading large files for > processing. I want to launch a subprocess to process the file so the > user doesn't have to wait for the page to load. > > What is the correct way to launch subprocess without waiting for the > result to retu

Re: improving a huge double-for cycle

2008-09-19 Thread Jake Anderson
Bruno Desthuilliers wrote: Alexzive a écrit : Hello there :) , I am a python newbie and need to run following code for a task in an external simulation programm called "Abaqus" which makes use of python to access the mesh (ensamble of nodes with xy coordinates) of a certain geometrical model.

Re: Twisted vs Python Sockets

2008-09-19 Thread Michael Palmer
On Sep 18, 4:24 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > James Matthews wrote: > > I am wondering what are the major points of twisted over regular python > > sockets. I am looking to write a TCP server and want to know the pros > > can cons of using one over the other. > > Twisted is a commu

Re: Python newbie

2008-09-19 Thread Grant Edwards
On 2008-09-19, Mladen Gogala <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > >> No. Python implicitly dereferences all names when using them >> to compute values, and only uses them as references on the >> left-hand side of an assignment. >> >> Please note the above statement is contentious, an

Re: generator exceptions

2008-09-19 Thread Michael Palmer
On Sep 19, 9:40 am, Alexandru Mosoi <[EMAIL PROTECTED]> wrote: > i have a generator that raises an exception when calling next(), > however if I try to catch the exception and print the traceback i get > only the line where next() was called > > while True: > try: > iterator.next() > excep

Re: Intercepting printed strings

2008-09-19 Thread Gabriel Genellina
En Fri, 19 Sep 2008 10:37:00 -0300, Robert Dailey <[EMAIL PROTECTED]> escribió: On Fri, Sep 19, 2008 at 4:21 AM, Gabriel Genellina <[EMAIL PROTECTED]>wrote: En Thu, 18 Sep 2008 19:24:26 -0300, Robert Dailey <[EMAIL PROTECTED]> escribió: I'm currently using Python 3.0 b3 and I'm curious as

Multimapping and string converting

2008-09-19 Thread Ron Brennan
Hello, I have a multimap dictionary with a 1 Key to N values. I want to convert the N values to a string to be used elsewhere in my program. So I have dict[(1,[1, 2 ,3 ,4])] which I have sorted When I do a print ''.join(str(dict.value())) I get [1, 2, 3, 4] as an output when I really want 1 2 3

generator exceptions

2008-09-19 Thread Alexandru Mosoi
i have a generator that raises an exception when calling next(), however if I try to catch the exception and print the traceback i get only the line where next() was called while True: try: iterator.next() except StopIteration: break except Exception, e: traceback.print_exc() h

Re: Intercepting printed strings

2008-09-19 Thread Robert Dailey
On Fri, Sep 19, 2008 at 4:21 AM, Gabriel Genellina <[EMAIL PROTECTED]>wrote: > En Thu, 18 Sep 2008 19:24:26 -0300, Robert Dailey <[EMAIL PROTECTED]> > escribió: > > > I'm currently using Python 3.0 b3 and I'm curious as to how I can go about >> intercepting things send to print() for some interme

Re: dict generator question

2008-09-19 Thread bearophileHUGS
Gerard flanagan: > data.sort() > datadict = \ > dict((k, len(list(g))) for k,g in groupby(data, lambda s: > '.'.join(s.split('.',2)[:2]))) That code may run correctly, but it's quite unreadable, while good Python programmers value high readability. So the right thing to do is to split that l

Re: dict generator question

2008-09-19 Thread Gerard flanagan
Boris Borcic wrote: Gerard flanagan wrote: George Sakkis wrote: .. Note that this works correctly only if the versions are already sorted by major version. Yes, I should have mentioned it. Here's a fuller example below. There's maybe better ways of sorting version numbers, but this is wha

Re: PEP proposal optparse

2008-09-19 Thread Pete Forman
James <[EMAIL PROTECTED]> writes: > I would like to know your thoughts on a proposed change to optparse > that I have planned. It is possible to add default values to > multiple options using the set_defaults. However, when adding > descriptions to options the developer has to specify it in ea

Re: Installing pySerial

2008-09-19 Thread Joe G (Home)
Yep up and running now. Many thanks Joe -- http://mail.python.org/mailman/listinfo/python-list

Re: Deflate with urllib2...

2008-09-19 Thread Gabriel Genellina
En Thu, 18 Sep 2008 23:29:30 -0300, Sam <[EMAIL PROTECTED]> escribió: On Sep 18, 2:10 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Tue, 16 Sep 2008 21:58:31 -0300, Sam <[EMAIL PROTECTED]> escribió: The code is correct - try with another server. I tested it with a   LightHTTPd server and

Re: dict generator question

2008-09-19 Thread Boris Borcic
Gerard flanagan wrote: George Sakkis wrote: .. Note that this works correctly only if the versions are already sorted by major version. Yes, I should have mentioned it. Here's a fuller example below. There's maybe better ways of sorting version numbers, but this is what I do. Indeed, you

Problem with Python shell through Cygwin Screen (Python/Vim/Screen combo)

2008-09-19 Thread Ant
Hi all, There's a sweet combination of tools that you can assemble using Vim, a Python shell (or any shell for that matter) and GNU screen, where you essentially send selected text from Vim to the Python shell. (See http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/ for more details -

Re: webbrowser fragment identifier

2008-09-19 Thread Gabriel Genellina
En Thu, 18 Sep 2008 21:53:22 -0300, scottbvfx <[EMAIL PROTECTED]> escribió: I'm trying to launch a web browser along with an html file with a fragment identifier in its path. I'm using the webbrowser module for this. ie. webbrowser.open('file:///C:/myfile.html#SomeEntryInTheHTML') for some re

Re: webbrowser fragment identifier

2008-09-19 Thread Tim Golden
scottbvfx wrote: Hi, I'm trying to launch a web browser along with an html file with a fragment identifier in its path. I'm using the webbrowser module for this. ie. webbrowser.open('file:///C:/myfile.html#SomeEntryInTheHTML') for some reason it is truncating the path to 'file:///C:/myfile.html

Re: Python, Factset, and Excel - Oh my!

2008-09-19 Thread Gabriel Genellina
En Thu, 18 Sep 2008 16:41:36 -0300, Desmond Scott E <[EMAIL PROTECTED]> escribió: I'm still a Python novice. I'm still attempting to migrate a Python-based process from Windows2000/Python v2.4.2 (#67)/Excel2000 to WindowsXP/Python v2.5.2 (r252:60911)/Excel2003. I now have a new "opportunity"!

Re: Login to website using urllib2

2008-09-19 Thread Gabriel Genellina
En Thu, 18 Sep 2008 10:23:50 -0300, Mohit Ranka <[EMAIL PROTECTED]> escribió: I am trying to fetch HTML content from a website that has different version of pages for "logged" users and "guseuests" users. I need to fetch the "logged" user pages. The problem is, even with the use

Re: Intercepting printed strings

2008-09-19 Thread Gabriel Genellina
En Thu, 18 Sep 2008 19:24:26 -0300, Robert Dailey <[EMAIL PROTECTED]> escribió: I'm currently using Python 3.0 b3 and I'm curious as to how I can go about intercepting things send to print() for some intermediate processing before they're actually sent to sys.stdout. Right now I've thought

Re: improving a huge double-for cycle

2008-09-19 Thread Gabriel Genellina
En Fri, 19 Sep 2008 02:11:51 -0300, Tino Wildenhain <[EMAIL PROTECTED]> escribió: Also I never saw a list where the threading often goes wrong like this here - is there any special setup or is it just peoples MUA which screws up? Perhaps it's due to the newsgroup/list duality... -- Gabriel

Re: Python newbie

2008-09-19 Thread kaer
On 19 sep, 10:13, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 19 Sep 2008 09:13:48 +0200, Mladen Gogala wrote: > > I am a Python newbie who decided to see what that Python fuss is all > > about. Quite frankly, I am a bit perplexed., here is what perplexes me: > > perl -e '@a=(1,2,3); map

Re: improving a huge double-for cycle

2008-09-19 Thread Alex Ziller
Thank you all for replying me! special thanks to Tino. Your code rocks! I got all the double nodes in couple of seconds and in a useful output with the coupled nodes pro line.. cheers from Germany! 2008/9/18 Tino Wildenhain <[EMAIL PROTECTED]> > Tino Wildenhain wrote: > >> H

Re: Python newbie

2008-09-19 Thread Tim Golden
Mladen Gogala wrote: Steve Holden wrote: No. Python implicitly dereferences all names when using them to compute values, and only uses them as references on the left-hand side of an assignment. Please note the above statement is contentious, and will likely bring a horde of screaming fanatics

Re: Python and Open Office

2008-09-19 Thread Hartmut Goebel
Terry Reedy schrieb: Hartmut Goebel wrote: The API docs are a bit hidden on the webpage. Here is the link: I wrote my comment *after* looking at the above, which I found easily enough. After 7 pages of (helpful) explanatory text

Re: Python newbie

2008-09-19 Thread Mladen Gogala
Steve Holden wrote: > No. Python implicitly dereferences all names when using them to compute > values, and only uses them as references on the left-hand side of an > assignment. > > Please note the above statement is contentious, and will likely bring a > horde of screaming fanatics of various f

Re: Python newbie

2008-09-19 Thread Steven D'Aprano
On Fri, 19 Sep 2008 03:34:50 -0400, Steve Holden wrote: > Please note the above statement is contentious, and will likely bring a > horde of screaming fanatics of various flavors down on my head for > terminological inexactitude. A pox on you and your descendants onto the tenth generation! *win

Re: Python newbie

2008-09-19 Thread Steven D'Aprano
On Fri, 19 Sep 2008 09:13:48 +0200, Mladen Gogala wrote: > I am a Python newbie who decided to see what that Python fuss is all > about. Quite frankly, I am a bit perplexed. Naturally you will be perplexed if you assume that Python is just Perl with a more verbose syntax. It isn't. > After ha

Re: SMTP via GMAIL

2008-09-19 Thread Steve Holden
Grant Edwards wrote: > On 2008-09-18, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >> In message >> <[EMAIL PROTECTED]>, sui >> wrote: >> >>> Traceback (most recent call last): >>> File "mail5.py", line 21, in >>> session = smtplib.SMTP(SMTPserver,port) >>> File "/usr/local/lib/python2.5

Re: Python newbie

2008-09-19 Thread Marc 'BlackJack' Rintsch
On Fri, 19 Sep 2008 09:13:48 +0200, Mladen Gogala wrote: > There are several questions: > > 1) Why is the array "a" unchanged after undergoing a transformation with >map? Because `map()` creates a new list and doesn't change the elements in `a`. > 2) Why is it illegal to pass a built-in fun

Re: XML Processing

2008-09-19 Thread Steve Holden
Robert Rawlins wrote: >> Some is going to kick themselves when they realise >> that ElementTree *is* built in to Python 2.5 >> >> http://docs.python.org/whatsnew/modules.html#SECTION000142 > > Tim, Andrii, > > Thanks for the heads up on that! I hadn't noticed they're made it part

Re: Python newbie

2008-09-19 Thread Steve Holden
Mladen Gogala wrote: > I am a Python newbie who decided to see what that Python fuss is all about. > Quite frankly, I am a bit perplexed. After having had few months of > experience with Perl (started in 1994 with Perl v4, and doing it ever > since) , here is what perplexes me: > > perl -e '@a=(1,

Re: Python newbie

2008-09-19 Thread Tino Wildenhain
Hi, Mladen Gogala wrote: I am a Python newbie who decided to see what that Python fuss is all about. Quite frankly, I am a bit perplexed. After having had few months of experience with Perl (started in 1994 with Perl v4, and doing it ever since) , here is what perplexes me: perl -e '@a=(1,2,3);

Re: Extracting hte font name from a TrueType font file

2008-09-19 Thread Steve Holden
Aaron "Castironpi" Brady wrote: > On Sep 18, 7:48 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> Fredrik Lundh wrote: >>> Steve Holden wrote: Does anyone have a Python recipe for this? >> from PIL import ImageFont >> f = ImageFont.truetype("/windows/fonts/verdanai.ttf", 1) >> f.fon

Python newbie

2008-09-19 Thread Mladen Gogala
I am a Python newbie who decided to see what that Python fuss is all about. Quite frankly, I am a bit perplexed. After having had few months of experience with Perl (started in 1994 with Perl v4, and doing it ever since) , here is what perplexes me: perl -e '@a=(1,2,3); map { $_*=2 } @a; map { pri