Building PIL under Cygwin & Python 2.5

2009-05-28 Thread Erik Johnson
This has apparently been a problematic thing for a while now, as the following article indicates. I first ran into the error message about not being able to remap C:\cygwin\bin\tk84.dll to be the same address as it's parent. Using that information, Google helped me find this article: http://blog.

Re: newbie: popen question

2009-05-28 Thread Sean DiZazzo
On May 27, 6:10 pm, thebiggestbangthe...@gmail.com wrote: > hello everyone :-), >                          I am a newbie to python. I am trying to run a > bash script from within a python program. I would greatly appreciate > any pointers/comments about how to get around the problem I am facing. >

Re: newbie: popen question

2009-05-28 Thread Jeremiah Dodds
On Thu, May 28, 2009 at 9:11 AM, Sean DiZazzo wrote: > On May 27, 6:10 pm, thebiggestbangthe...@gmail.com wrote: > > hello everyone :-), > > I am a newbie to python. I am trying to run a > > bash script from within a python program. I would greatly appreciate > > any point

Re: nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

2009-05-28 Thread Jon Bendtsen
Dennis Lee Bieber wrote: > On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen > declaimed the following in gmane.comp.python.general: > >> 'From: r...@laerdal.dk\nsubject: testing\nNewsgroups: test\nBody: >> \n\n\nfoobar\n\n\n.\n\n\n' >> > I believe NNTP, like SMTP, requires \r\n line termina

Re: What text editor is everyone using for Python

2009-05-28 Thread Lawrence D'Oliveiro
In message <0039e83c$0$9673$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > A good UI standard should mean that: > > * all functionality should be discoverable without reading the manual; Which means no scripting languages are allowed? -- http://mail.python.org/mailman/listinfo/python-li

Re: What text editor is everyone using for Python

2009-05-28 Thread Tim Cook
On May 26, 9:07 am, Lacrima wrote: > I am new to python. > And now I am using trial version of Wing IDE. > But nobody mentioned it as a favourite editor. > So should I buy it when trial is expired or there are better choices? I use nothing but Wing. Their support is great as well. -- http://ma

Re: What text editor is everyone using for Python

2009-05-28 Thread Chris Jones
On Thu, May 28, 2009 at 12:06:25AM EDT, Steven D'Aprano wrote: > On Wed, 27 May 2009 22:34:45 -0400, Chris Jones wrote: > > I'm unsure about a python editor for everyone but since acquiring > > habits takes time, I'm in favor of sticking to one editor for > > everything. > > Or use an editor whic

Re: Python, Tkinter and popen problem

2009-05-28 Thread Peter Otten
norseman wrote: > Peter Otten wrote: >> norseman wrote: >> >>> This was sent 5/19/09 and as yet has received no comments. >> >>> I'm resending just in case a new reader might have an answer. >> >> If you had posted two tiny scripts demonstrating your problem instead of >> the longwinded explana

Re: What text editor is everyone using for Python

2009-05-28 Thread Paul Rudin
Steven D'Aprano writes: > * if possible, all functionality should be capable of being performed by > either the mouse or keyboard. I'd imagine that the requirement that *all* functionality can be performed with the mouse rules out many text editors. Almost the defining feature of a text editor

Unpack less values from function's return values

2009-05-28 Thread dudeja . rajat
Hi, I'm using Python 2.5.2. I'm getting this error whenever I try to unpack less values from a function. ValueError: too many values to unpack I want to know if there is a way I can unpack less values returning from a function? Thanks, Rajat -- http://mail.python.org/mailman/listinfo/python-l

Re: What text editor is everyone using for Python

2009-05-28 Thread Andreas Roehler
Esmail wrote: > LittleGrasshopper wrote: >> >> So what do you guys use, and why? Hopefully we can keep this civil. > > I use Emacs, just because I have been using this editor for > all sorts of things in the last 20+ years. > > I haven't been able to get the python mode to work for Windows A bug

Re: Inheritance and Design Question

2009-05-28 Thread Jean-Michel Pichavant
imageguy wrote: I have an object the I would like to use as a base class. Some of the methods I would like to override completely, but others I would simply like to call the base class method and use the return value in the child method. The purpose here is to eliminate the duplication of valua

Re: What text editor is everyone using for Python

2009-05-28 Thread Andreas Roehler
Rhodri James wrote: > On Tue, 26 May 2009 14:22:29 +0100, Roy Smith wrote: > >> My pet peeve is syntax-aware editors which get things wrong. For >> example, >> the version of emacs I'm using now doesn't parse this properly: >> >> '''A triple-quoted string. Some editors won't get this right''' >

Re: How do I sample randomly based on some probability(wightage)?

2009-05-28 Thread Antoon Pardon
Op 2009-05-26, Arnaud Delobelle schreef : > Sumitava Mukherjee writes: > >> On May 26, 11:39 pm, Sumitava Mukherjee wrote: >>> Hi all, >>> I need to randomly sample from a list where all choices have weights >>> attached to them. The probability of them being choosen is dependent >>> on the weigh

Re: What text editor is everyone using for Python

2009-05-28 Thread Andreas Roehler
Rhodri James wrote: > On Wed, 27 May 2009 16:56:12 +0100, Bruno Desthuilliers > wrote: > >> Rhodri James a écrit : >>> On Tue, 26 May 2009 14:22:29 +0100, Roy Smith wrote: >>> My pet peeve is syntax-aware editors which get things wrong. For example, the version of emacs I'm using

Re: Question in VB DLL COM event in Delphi Programming

2009-05-28 Thread MRAB
Tan, Yih Hung wrote: I have a question regarding Delphi COM programming. I have a VB DLL (ActiveX COM DLL) and this DLL contain 2 classes, one is for normal client function calling, and the other one is events raised by this DLL to notify the client. Now, I would like to incorporate this DLL in

Re: Multiprocessing problem with producer/consumer

2009-05-28 Thread MRAB
Wu Zhe wrote: I am writing a server program with one producer and multiple consumers, what confuses me is only the first task producer put into the queue gets consumed, after which tasks enqueued no longer get consumed, they remain in the queue forever. from multiprocessing import Process, Pool,

Re: download all mib files from a web page

2009-05-28 Thread Chris Rebert
On Wed, May 27, 2009 at 9:29 AM, powah wrote: > I want to download all mib files from the web page: > http://www.juniper.net/techpubs/software/junos/junos94/swconfig-net-mgmt/juniper-specific-mibs-junos-nm.html#jN18E19 > > All mib filenames are of this format: > www.juniper.net/techpubs ... .txt >

Re: download all mib files from a web page

2009-05-28 Thread Chris Rebert
On Wed, May 27, 2009 at 11:06 AM, powah wrote: > On May 27, 12:29 pm, powah wrote: >> I want to download all mib files from the web >> page:http://www.juniper.net/techpubs/software/junos/junos94/swconfig-net-m... >> >> All mib filenames are of this format:www.juniper.net/techpubs... .txt >> >> I

Re: Python, Tkinter and popen problem

2009-05-28 Thread MRAB
norseman wrote: Peter Otten wrote: norseman wrote: This was sent 5/19/09 and as yet has received no comments. I'm resending just in case a new reader might have an answer. If you had posted two tiny scripts demonstrating your problem instead of the longwinded explanation I might have tin

Resize ctypes array

2009-05-28 Thread Scott Sibley
I'd like to resize a ctypes array. As you can see, ctypes.resize doesn't work like it could. I can write a function to resize an array, but I wanted to know some other solutions to this. Maybe I'm missing some ctypes trick or maybe I simply used resize wrong. The name c_long_Array_0 seems to tell m

Re: Resize ctypes array

2009-05-28 Thread Scott Sibley
I found an answer to this over on Stackoverflow. http://stackoverflow.com/questions/919369/resize-ctypes-array On Thu, May 28, 2009 at 1:25 AM, Scott Sibley wrote: > I'd like to resize a ctypes array. As you can see, ctypes.resize doesn't > work like it could. I can write a function to resize an

Re: Unpack less values from function's return values

2009-05-28 Thread Chris Rebert
On Thu, May 28, 2009 at 3:19 AM, wrote: > Hi, > > I'm using Python 2.5.2. I'm getting this error whenever I try to unpack less > values from a function. > > ValueError: too many values to unpack > > > I want to know if there is a way I can unpack less values returning from a > function? Unpack t

Re: Inheritance and Design Question

2009-05-28 Thread Steven D'Aprano
On Wed, 27 May 2009 17:21:23 -0400, Terry Reedy wrote: > super() was designed for multiple inheritance. Surely you mean that super() was designed for *inheritance*, multiple or singular? Working with single inheritance is part of the design, not an accident of implementation. > The only reaso

Re: DB-API execute params, am I missing something?

2009-05-28 Thread Lawrence D'Oliveiro
In message , Dennis Lee Bieber wrote: > On Thu, 28 May 2009 13:12:57 +1200, Lawrence D'Oliveiro > declaimed the following in > gmane.comp.python.general: > >> >> What if the string you're searching for includes a "%" or "_" character? > >>>> db.literal((... "%wildcard%" ...)) >(... "'

Re: Building Python with icc on 64-bit Linux

2009-05-28 Thread Andrew MacIntyre
Konrad Hinsen wrote: /home/shr/khinsen/tmp/Python-2.6.2/Modules/_ctypes/libffi/src/x86/ffi64.c(43): \ error: identifier "__int128_t" is undefined __int128_t sse[MAX_SSE_REGS]; ^ compilation aborted for /home/shr/khinsen/tmp/Python-2.6.2/Modules/_ctypes/libf\ fi/src/x86/ffi64.c (code 2

Re: GUI Programming

2009-05-28 Thread Michiel Overtoom
On Sunday 12 April 2009 15:07:11 Gabriel wrote: > I'm python newbie and i need to write gui for my school work in python. > I need to write it really quick, because i haven't much time .) Try Tkinter, which is included by default with most Python installations. Writing simple programs is easy li

Re: What text editor is everyone using for Python

2009-05-28 Thread Steven D'Aprano
On Thu, 28 May 2009 05:44:07 -0400, Chris Jones wrote: >> * if possible, all functionality should be capable of being performed >> by either the mouse or keyboard. > > All valid points on the face of it, but doesn't the above rule out both > vim and emacs? Your point is? *ducks and runs* --

Re: What text editor is everyone using for Python

2009-05-28 Thread Steven D'Aprano
On Thu, 28 May 2009 11:08:08 +0100, Paul Rudin wrote: > Steven D'Aprano writes: > > >> * if possible, all functionality should be capable of being performed >> by either the mouse or keyboard. > > I'd imagine that the requirement that *all* functionality can be > performed with the mouse rules

Re: What text editor is everyone using for Python

2009-05-28 Thread Steven D'Aprano
On Thu, 28 May 2009 20:58:07 +1200, Lawrence D'Oliveiro wrote: > In message <0039e83c$0$9673$c3e8...@news.astraweb.com>, Steven D'Aprano > wrote: > >> A good UI standard should mean that: >> >> * all functionality should be discoverable without reading the manual; > > Which means no scripting l

Re: What text editor is everyone using for Python

2009-05-28 Thread David Robinow
On Thu, May 28, 2009 at 7:09 AM, Andreas Roehler wrote: > Rhodri James wrote: >> and I'll get over that.  The feature that caused me to uninstall >> python-mode.el was its bloody-minded determination to regard '_' as a word >> character, something which caused me more typing that it ever saved. >

Re: What text editor is everyone using for Python

2009-05-28 Thread Chris Jones
On Thu, May 28, 2009 at 07:38:33AM EDT, Steven D'Aprano wrote: > Your point is? notepad, otoh.. > *ducks and runs* .. likewise. -- http://mail.python.org/mailman/listinfo/python-list

Re: What text editor is everyone using for Python

2009-05-28 Thread Rhodri James
On Thu, 28 May 2009 06:24:56 +0100, Paul Rudin wrote: "Rhodri James" writes: The feature that caused me to uninstall python-mode.el was its bloody-minded determination to regard '_' as a word character, something which caused me more typing that it ever saved. Probably you could have cha

Re: newbie: popen question

2009-05-28 Thread Sebastian Wiesner
> Your best bet is to make sudo not ask for a password. :) If you > don't have the rights, then you can use pexpect to do what you want to > do. http://pexpect.sourceforge.net/pexpect.html > > See the second example on that page. > > child = pexpect.spawn('scp foo myn...@host.example.com:.')

Re: What text editor is everyone using for Python

2009-05-28 Thread Esmail
Andreas Roehler wrote: Esmail wrote: LittleGrasshopper wrote: So what do you guys use, and why? Hopefully we can keep this civil. I use Emacs, just because I have been using this editor for all sorts of things in the last 20+ years. I haven't been able to get the python mode to work for Windo

Re: What text editor is everyone using for Python

2009-05-28 Thread Jason S. Friedman
I use Eclipse (www.eclipse.org) with the PyDev plugin (pydev.sourceforge.net). -- http://mail.python.org/mailman/listinfo/python-list

[pyunit] Only run one specific test

2009-05-28 Thread Nikolaus Rath
Hi, Consider these two files: , mytest.py - | #!/usr/bin/env python | import unittest | | class myTestCase(unittest.TestCase): | def test_foo(self): | pass | | # Somehow important according to pyunit documentation | def suite(): | return unittest.makeSuite(myTestCase) `---

Re: What text editor is everyone using for Python

2009-05-28 Thread paffnucy
Or you can try pyscripter http://code.google.com/p/pyscripter/ Very fast, lightwieght and powerfull python editor. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to reuse TCP listening socket immediately after it was connected at least once?

2009-05-28 Thread Thomas Bellman
Roy Smith wrote: > In article , > Lawrence D'Oliveiro wrote: >> The right thing to do is try to ensure that all your connections are >> properly closed at shutdown. That may not be enough (if your server crashes >> due to bugs), so the other thing you need to do is retry the socket open, >> say

Re: Unpack less values from function's return values

2009-05-28 Thread Bobby
On May 28, 5:40 am, Chris Rebert wrote: > On Thu, May 28, 2009 at 3:19 AM,   wrote: > > Hi, > > > I'm using Python 2.5.2. I'm getting this error whenever I try to unpack less > > values from a function. > > > ValueError: too many values to unpack > > > I want to know if there is a way I can unpack

Re: 4 hundred quadrillonth?

2009-05-28 Thread Aahz
In article <4a1da210$0$90265$14726...@news.sunsite.dk>, Mark Dickinson wrote: > >This is getting rather long. Perhaps I should put the above comments >together into a 'post-PEP' document. Yes, you should. Better explanation of floating point benefits everyone when widely available. I even lear

Most pythonic way to truncate unicode?

2009-05-28 Thread Andrew Fong
I need to ... 1) Truncate long unicode (UTF-8) strings based on their length in BYTES. For example, u'\u4000\u4001\u4002 abc' has a length of 7 but takes up 13 bytes. Since u'\u4000' takes up 3 bytes, I want truncate (u'\u4000\u4001\u4002 abc',3) == u'\u4000' -- as compared to u'\u4000\u4001\u4002

Re: What text editor is everyone using for Python

2009-05-28 Thread Gabor Urban
I use Emacs, as for the other editing activities. I like it for it is very powerfull. -- Linux: Choice of a GNU Generation -- http://mail.python.org/mailman/listinfo/python-list

Re: Most pythonic way to truncate unicode?

2009-05-28 Thread Peter Otten
Andrew Fong wrote: > I need to ... > > 1) Truncate long unicode (UTF-8) strings based on their length in > BYTES. For example, u'\u4000\u4001\u4002 abc' has a length of 7 but > takes up 13 bytes. Since u'\u4000' takes up 3 bytes, I want truncate > (u'\u4000\u4001\u4002 abc',3) == u'\u4000' -- as

Deletion/record visibility error in PG with Python...

2009-05-28 Thread Durumdara
Hi! PGSQL makes me crazy... I port my apps to PGSQL, and I near to finish - but I got this problem... Params: PGSQL 8.3, Windows, Pylons, PGDB, DBUTILS... I opened the connection with DBUTILS. I have one thread (the test thread), possible it have more in the background, I don't know... See thi

Re: newbie: popen question

2009-05-28 Thread thebiggestbangtheory
On May 28, 5:31 am, Sebastian Wiesner wrote: > > > > Your best bet is to make sudo not ask for a password.  :)  If you > > don't have the rights, then you can use pexpect to do what you want to > > do.  http://pexpect.sourceforge.net/pexpect.html > > > See the second example on that page. > > > c

Re: Adding a Par construct to Python?

2009-05-28 Thread Aaron Brady
On May 27, 11:07 pm, Steven D'Aprano wrote: > On Wed, 27 May 2009 12:58:02 +, Albert van der Horst wrote: > > >>And how is reduce() supposed to know whether or not some arbitrary > >>function is commutative? > > > Why would it or need it? A Python that understands the ``par'' keyword > > is su

Re: Seeking old post on developers who like IDEs vs developers who like simple languages

2009-05-28 Thread Mohan Parthasarathy
On Mon, May 18, 2009 at 12:31 AM, Ulrich Eckhardt wrote: > Steve Ferg wrote: > > On the one hand, there are developers who love big IDEs with lots of > > features (code generation, error checking, etc.), and rely on them to > > provide the high level of support needed to be reasonably productive >

py2app and OpenGL, "No module named util" in ctypes

2009-05-28 Thread trhaynes
I'm trying to use py2app to package an OpenGL app, so first I tried to build the example here http://svn.pythonmac.org/py2app/py2app/trunk/examples/PyOpenGL/ and I get the error: > File > "/opt/local/lib/python2.5/site-packages/PyOpenGL-3.0.0c1-py2.5.egg/OpenGL/platform/darwin.py", > line 24,

Re: [pyunit] Only run one specific test

2009-05-28 Thread Dave Angel
Nikolaus Rath wrote: Hi, Consider these two files: , mytest.py - | #!/usr/bin/env python | import unittest | | class myTestCase(unittest.TestCase): | def test_foo(self): | pass | | # Somehow important according to pyunit documentation | def suite(): | return unittest.m

What is the purpose of "struct" and "array" modules

2009-05-28 Thread Igor Katson
I pretty much understand what they do, but what's the case of using these modules by example? Is it something like pickle, to store the data efficiently in files? -- http://mail.python.org/mailman/listinfo/python-list

Re: Seeking old post on developers who like IDEs vs developers who like simple languages

2009-05-28 Thread Benjamin Kaplan
On Thu, May 28, 2009 at 2:09 PM, Mohan Parthasarathy wrote: > > > On Mon, May 18, 2009 at 12:31 AM, Ulrich Eckhardt > wrote: > >> Steve Ferg wrote: >> > On the one hand, there are developers who love big IDEs with lots of >> > features (code generation, error checking, etc.), and rely on them to

how to change response code in CGIHTTPServer.py

2009-05-28 Thread Daniel
Hello, Python 2.5.2 WinXP I'm using CGIHTTPServer.py and want to return a response code of 400 with a message in the event that the cgi script fails for some reason. I notice that run_cgi(self): executes this line of code, self.send_response(200, "Script output follows") which overwrites any hea

Re: How does Python's OOP feel?

2009-05-28 Thread Joshua Kugler
> The good thing about python is : it 'tastes' like what it was being > advertised +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

AOPython Question

2009-05-28 Thread Roastie
I installed the AOPython module: % easy_install aopython That left an aopython-1.0.3-py2.6.egg at C:\mystuff\python\python_2.6.2\Lib\site-packages. I entered the interpreter: >>> import aopython >>> All is well. But I was uncomfortable, since I was used to seeing directories of Python code

Re: download all mib files from a web page

2009-05-28 Thread powah
On May 27, 3:37 pm, Scott David Daniels wrote: > powah wrote: > > ... > > I fixed one error, now if the filename is misspelled, how to ignore > > the error and continue? > > You really should go through the tutorial.  It will explain this and > other important things well.  But, since I'm feeling

Re: Python, Tkinter and popen problem

2009-05-28 Thread norseman
Peter Otten wrote: norseman wrote: Peter Otten wrote: norseman wrote: This was sent 5/19/09 and as yet has received no comments. I'm resending just in case a new reader might have an answer. If you had posted two tiny scripts demonstrating your problem instead of the longwinded explanation

Re: Adding a Par construct to Python?

2009-05-28 Thread CTO
On May 28, 1:53 pm, Aaron Brady wrote: > On May 27, 11:07 pm, Steven D'Aprano > cybersource.com.au> wrote: > > On Wed, 27 May 2009 12:58:02 +, Albert van der Horst wrote: > > > >>And how is reduce() supposed to know whether or not some arbitrary > > >>function is commutative? > > > > Why woul

Re: [pyunit] Only run one specific test

2009-05-28 Thread Nikolaus Rath
Dave Angel writes: > Nikolaus Rath wrote: >> Hi, >> >> Consider these two files: >> >> , mytest.py - >> | #!/usr/bin/env python >> | import unittest >> | | class myTestCase(unittest.TestCase): >> | def test_foo(self): >> |pass >> | | # Somehow important according to pyunit document

Re: AOPython Question

2009-05-28 Thread Mike Driscoll
On May 28, 1:43 pm, Roastie wrote: > I installed the AOPython module: > >    % easy_install aopython > > That left an aopython-1.0.3-py2.6.egg at > C:\mystuff\python\python_2.6.2\Lib\site-packages. > > I entered the interpreter: > > >>> import aopython > > All is well. > > But I was uncomfortable,

Re: What text editor is everyone using for Python

2009-05-28 Thread JanC
Hendrik van Rooyen wrote: > When ssh- ing I have been using vim, painfully. Must look at nano - sounds > good. > I really miss Brief. Or try 'joe'. -- JanC -- http://mail.python.org/mailman/listinfo/python-list

Re: AOPython Question

2009-05-28 Thread Mike Driscoll
On May 28, 3:10 pm, Mike Driscoll wrote: > On May 28, 1:43 pm, Roastie wrote: > > > > > I installed the AOPython module: > > >    % easy_install aopython > > > That left an aopython-1.0.3-py2.6.egg at > > C:\mystuff\python\python_2.6.2\Lib\site-packages. > > > I entered the interpreter: > > > >>>

Re: what I would like python.el to do (and maybe it does)

2009-05-28 Thread Piet van Oostrum
> J Kenneth King (JKK) wrote: >JKK> I find that it does work, but unlike SLIME for lisp, it just imports the >statement. >JKK> It confused me at first, but basically the interpreter doesn't provide >JKK> any feedback to emacs. >JKK> Try opening a python source file (start python-mode if yo

Re: py2app and OpenGL, "No module named util" in ctypes

2009-05-28 Thread Ned Deily
In article , trhaynes wrote: > I'm trying to use py2app to package an OpenGL app [...] You might try asking on the pythonmac-sig list: more py2app users there most likely. http://mail.python.org/mailman/listinfo/pythonmac-sig [or] http://dir.gmane.org/gmane.comp.python.apple -- Ned Deily,

Problem building 64-bit python 2.6.2 on Solaris 10

2009-05-28 Thread John Center
Hi, I'm trying to build python 2.6.2 on Solaris 10 (SPARC 64), using Sun Studio 12, but I'm having a few problems getting a clean build. The python configure options are: with_gcc=no with_universal_archs=64-bit with_cxx_main="CC -m64" The first problem I'm having is _ssl.so not building: cc -m

Re: AOPython Question

2009-05-28 Thread David Bolen
Roastie writes: > I installed the AOPython module: > >% easy_install aopython > > That left an aopython-1.0.3-py2.6.egg at > C:\mystuff\python\python_2.6.2\Lib\site-packages. An egg is basically a ZIP file with a specific structure (you can inspect it with common ZIP tools). Depending on th

Re: What text editor is everyone using for Python

2009-05-28 Thread Lawrence D'Oliveiro
In message <003a5518$0$9673$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > On Thu, 28 May 2009 20:58:07 +1200, Lawrence D'Oliveiro wrote: > >> In message <0039e83c$0$9673$c3e8...@news.astraweb.com>, Steven D'Aprano >> wrote: >> >>> A good UI standard should mean that: >>> >>> * all funct

Re: How to reuse TCP listening socket immediately after it was connected at least once?

2009-05-28 Thread Lawrence D'Oliveiro
In message , Thomas Bellman wrote: > Speaking as a sysadmin, running applications for production, > programs not using SO_REUSEADDR should be taken out and shot. > Not using SO_REUSEADDR means forcing a service interruption of > half an hour (IIRC) if for some reason the service must be > restart

Re: py2app and OpenGL, "No module named util" in ctypes

2009-05-28 Thread norseman
ks more as expected with it. I also assume you have seen .../pythonXX/distutils and dist.pdf? Just in case you have not - take a look. Supposed to be how to package one's stuff for distribution. At least with python 2.5.2 on Linux Slackware 10.2 Today is: 20090528 Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: What is the purpose of "struct" and "array" modules

2009-05-28 Thread Matimus
On May 28, 11:17 am, Igor Katson wrote: > I pretty much understand what they do, but what's the case of using > these modules by example? Is it something like pickle, to store the data > efficiently in files? For one it provides a mechanism for reading and writing arbitrary file formats. For exam

Re: What is the purpose of "struct" and "array" modules

2009-05-28 Thread Scott David Daniels
Igor Katson wrote: I pretty much understand what they do, but what's the case of using these modules by example? Is it something like pickle, to store the data efficiently in files? Mostly it is for access to specific binary data structures. If you know a particular file format, you can read i

Re: What text editor is everyone using for Python

2009-05-28 Thread jeffFromOz
On May 26, 10:07 pm, Lacrima wrote: > I am new to python. > And now I am using trial version of Wing IDE. > But nobody mentioned it as a favourite editor. > So should I buy it when trial is expired or there are better choices? No one mentioned textmate either . a brilliant text editor with pytho

Re: Problem building 64-bit python 2.6.2 on Solaris 10

2009-05-28 Thread Martin v. Löwis
> I think the problem is it should be built with v9.S for 64-bit, not > v8.S. Is that correct? If so, how do I get it to use the right one? The Solaris dynamic loader can't find it. Set LD_LIBRARY_PATH or LD_RUN_PATH appropriately, or use crle(8). Regards, Martin -- http://mail.python.org/mail

Re: What text editor is everyone using for Python

2009-05-28 Thread norseman
jeffFromOz wrote: On May 26, 10:07 pm, Lacrima wrote: I am new to python. And now I am using trial version of Wing IDE. But nobody mentioned it as a favourite editor. So should I buy it when trial is expired or there are better choices? No one mentioned textmate either . a brilliant text edi

Re: py2app and OpenGL, "No module named util" in ctypes

2009-05-28 Thread Carl Banks
On May 28, 11:06 am, trhaynes wrote: > I'm trying to use py2app to package an OpenGL app, so first I tried to > build the example here > > http://svn.pythonmac.org/py2app/py2app/trunk/examples/PyOpenGL/ > > and I get the error: > > >  File > > "/opt/local/lib/python2.5/site-packages/PyOpenGL-3.0.

Re: Network programming ?

2009-05-28 Thread JanC
CTO wrote: > There's a book called Foundations of Python Network Programming that > is pretty much as good a book as you could ever ask for on the subject. I > strongly recommend it, and I think you'll find many of the examples > relevant. Yeah, I can recommend that book too. -- JanC -- http:

python list pattern matching?

2009-05-28 Thread guthrie
I want to do a functional like pattern match to get teh first two elements, and then the rest of an array return value. For example, assume that perms(x) returns a list of values, and I want to do this: seq=perms(x) a = seq[0] b = seq[1] rest = seq[2:] Of course I can shorten to:

Re: python list pattern matching?

2009-05-28 Thread Terry Reedy
guthrie wrote: I want to do a functional like pattern match to get teh first two elements, and then the rest of an array return value. For example, assume that perms(x) returns a list of values, and I want to do this: seq=perms(x) a = seq[0] b = seq[1] rest = seq[2:] Of course I

extract to dictionaries

2009-05-28 Thread Marius Retegan
Hello I have simple text file that I have to parse. It looks something like this: parameters1 key1 value1 key2 value2 end parameters2 key1 value1 key2 value2 end So I want to create two dictionaries parameters1={key1:value1, key2:value2} and the same for parameters2. I woud

Re: python list pattern matching?

2009-05-28 Thread Mensanator
On May 28, 5:43 pm, guthrie wrote: > I want to do a functional like pattern match to get teh first two > elements, and then the rest of an array return value. > > For example, assume that perms(x) returns a list of values, and I want > to do this: >     seq=perms(x) > >     a = seq[0] >     b = se

How can 'type' be an instance of itself?

2009-05-28 Thread LittleGrasshopper
This is probably trivial, but it's driving me mad somehow. All (new style) classes are instances of 'type' by default, unless a custom metaclass is specified. I take this to mean that when a class declaration is found in the code, an instance of 'type' representing that class is created by calling

Re: What text editor is everyone using for Python

2009-05-28 Thread Steven D'Aprano
On Fri, 29 May 2009 09:04:39 +1200, Lawrence D'Oliveiro wrote: > In message <003a5518$0$9673$c3e8...@news.astraweb.com>, Steven D'Aprano > wrote: > >> On Thu, 28 May 2009 20:58:07 +1200, Lawrence D'Oliveiro wrote: >> >>> In message <0039e83c$0$9673$c3e8...@news.astraweb.com>, Steven >>> D'Aprano

Re: python list pattern matching?

2009-05-28 Thread bearophileHUGS
Terry Reedy: >  >>> a,b,*rest = list(range(10)) >  >>> a,b,rest > (0, 1, [2, 3, 4, 5, 6, 7, 8, 9]) >  >>> a,*rest,b = 'abcdefgh' >  >>> a,rest,b > ('a', ['b', 'c', 'd', 'e', 'f', 'g'], 'h') For the next few years I generally suggest to specify the Python version too (if it's 2.x or 3.x). This is P

Re: How can 'type' be an instance of itself?

2009-05-28 Thread Christian Heimes
LittleGrasshopper wrote: > This is probably trivial, but it's driving me mad somehow. All (new > style) classes are instances of 'type' by default, unless a custom > metaclass is specified. I take this to mean that when a class > declaration is found in the code, an instance of 'type' representing

Re: How can 'type' be an instance of itself?

2009-05-28 Thread LittleGrasshopper
On May 28, 4:37 pm, Christian Heimes wrote: > LittleGrasshopper wrote: > > This is probably trivial, but it's driving me mad somehow. All (new > > style) classes are instances of 'type' by default, unless a custom > > metaclass is specified. I take this to mean that when a class > > declaration is

Re: extract to dictionaries

2009-05-28 Thread bearophileHUGS
Marius Retegan: > > parameters1 >      key1 value1 >      key2 value2 > end > > parameters2 >      key1 value1 >      key2 value2 > end > > So I want to create two dictionaries parameters1={key1:value1, > key2:value2} and the same for parameters2. I have wasted some time trying to create a regex f

Re: extract to dictionaries

2009-05-28 Thread Gary Herron
Marius Retegan wrote: Hello I have simple text file that I have to parse. It looks something like this: parameters1 key1 value1 key2 value2 end parameters2 key1 value1 key2 value2 end So I want to create two dictionaries parameters1={key1:value1, key2:value2} and the same f

Re: How can 'type' be an instance of itself?

2009-05-28 Thread LittleGrasshopper
On May 28, 4:37 pm, Christian Heimes wrote: > LittleGrasshopper wrote: > > This is probably trivial, but it's driving me mad somehow. All (new > > style) classes are instances of 'type' by default, unless a custom > > metaclass is specified. I take this to mean that when a class > > declaration is

Re: python list pattern matching?

2009-05-28 Thread Steven D'Aprano
On Thu, 28 May 2009 18:57:42 -0400, Terry Reedy wrote: > >>> a,b,*rest = list(range(10)) That fails in Python 2.5 and 2.6. >>> a,b,*rest = list(range(10)) File "", line 1 a,b,*rest = list(range(10)) ^ SyntaxError: invalid syntax -- Steven -- http://mail.python.org/mailman/li

Re: Adding a Par construct to Python?

2009-05-28 Thread Steven D'Aprano
On Thu, 28 May 2009 10:53:17 -0700, Aaron Brady wrote: > On May 27, 11:07 pm, Steven D'Aprano cybersource.com.au> wrote: >> On Wed, 27 May 2009 12:58:02 +, Albert van der Horst wrote: >> >> >>And how is reduce() supposed to know whether or not some arbitrary >> >>function is commutative? >> >

Re: Most pythonic way to truncate unicode?

2009-05-28 Thread Steven D'Aprano
On Thu, 28 May 2009 08:50:00 -0700, Andrew Fong wrote: > I need to ... > > 1) Truncate long unicode (UTF-8) strings based on their length in BYTES. Out of curiosity, why do you need to do this? > For example, u'\u4000\u4001\u4002 abc' has a length of 7 but takes up 13 > bytes. No, that's wro

problems with Cheetah base class being in templates directory

2009-05-28 Thread mobiledreamers
*How do we setup Cheetah so it runs with all templates in the templates directory and all code in the .. directory code.py* production=True if not production: try:web.render('mafbase.tmpl', None, True, 'mafbase') except:pass else: from templates import mafbase templates/mafbase.tmpl

Re: python list pattern matching?

2009-05-28 Thread guthrie
Many thanks to all; perfect solution! -- http://mail.python.org/mailman/listinfo/python-list

Re: What text editor is everyone using for Python

2009-05-28 Thread Lawrence D'Oliveiro
In message <003af57e$0$9673$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > On Fri, 29 May 2009 09:04:39 +1200, Lawrence D'Oliveiro wrote: > >> In message <003a5518$0$9673$c3e8...@news.astraweb.com>, Steven D'Aprano >> wrote: >> >>> On Thu, 28 May 2009 20:58:07 +1200, Lawrence D'Oliveiro w

Re: extract to dictionaries

2009-05-28 Thread Teguh Iskanto
You can create this modularly by : 1. parse the file and cut this into different chunks ( look for 'end' ) then you have two chunks for param 1 & 2 2. once you have those chunks then process each chunk with your own processing based on your parameters ( 1 or 2 ) 3. then based on your individual par

Tkinter file dialog

2009-05-28 Thread Ronn Ross
I'm using Tkinter file selector to get a direcotry path. I'm using: self.file = tkFileDialog.askdirectory(title="Please select your directory") print file but all it prints out is: How would I print the directory path? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Most pythonic way to truncate unicode?

2009-05-28 Thread John Machin
Andrew Fong gmail.com> writes: > I need to ... > 1) Truncate long unicode (UTF-8) strings based on their length in > BYTES. > 2) I don't want to accidentally chop any unicode characters in half. > If the byte truncate length would normally cut a unicode character in > 2, then I just want to drop

Re: Most pythonic way to truncate unicode?

2009-05-28 Thread John Machin
John Machin lexicon.net> writes: > Andrew Fong gmail.com> writes: > Are > > there any built-in ways to do something like this already? Or do I > > just have to iterate over the unicode string? > > Converting each character to utf8 and checking the > total number of bytes so far? > Ooooh, sloo

Re: What text editor is everyone using for Python

2009-05-28 Thread Steven D'Aprano
On Fri, 29 May 2009 14:00:19 +1200, Lawrence D'Oliveiro wrote: > In message <003af57e$0$9673$c3e8...@news.astraweb.com>, Steven D'Aprano > wrote: > >> On Fri, 29 May 2009 09:04:39 +1200, Lawrence D'Oliveiro wrote: >> >>> In message <003a5518$0$9673$c3e8...@news.astraweb.com>, Steven >>> D'Aprano

Re: Most pythonic way to truncate unicode?

2009-05-28 Thread Steven D'Aprano
On Fri, 29 May 2009 04:09:53 +, John Machin wrote: > John Machin lexicon.net> writes: > >> Andrew Fong gmail.com> writes: > > > Are >> > there any built-in ways to do something like this already? Or do I >> > just have to iterate over the unicode string? >> >> Converting each character t

  1   2   >