Re: dynamic library loading, missing symbols

2007-01-10 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > I suppose this means that any subsequent libraries dlopened will not > see any of the symbols in my module? That's correct, and intentional. Python has crashed in the past when symbols conflicted across shared libraries. > I guess I'll have to look through the Python

where to find the spec of format in PyObject_CallMethod

2007-01-10 Thread Huayang Xia
I am trying to use PyObject_CallMethod. It needs a format string to specify what are the followed arguments. Is it possible to use a PyObject* as an argument? Where can I find the spec for the format? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Problem installing cElementTree on Python 2.5

2007-01-10 Thread Piet van Oostrum
I have just installed Python 2.5 on Mac OS X 10.4.8 on an iBook (PPC) from the dmg. Now I tried to install cElementTree -1.0.5-20 from source (no egg available in cheeseshop) and got the following compilation error: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-ali

Re: where to find the spec of format in PyObject_CallMethod

2007-01-10 Thread Carsten Haese
On Wed, 2007-01-10 at 14:05 -0800, Huayang Xia wrote: > I am trying to use PyObject_CallMethod. It needs a format string to > specify what are the followed arguments. Is it possible to use a > PyObject* as an argument? > > Where can I find the spec for the format? > > Thanks in advance. See http

Python 2.5 install on Gentoo Linux: failed dmb and _tkinter

2007-01-10 Thread Sorin Schwimmer
Hi All, After a disaster in which I lost my whole harddrive, I decided to install the newest everything that I use. I put the latest Gentoo Linux, with gcc 4.1.1, installed tcl/tk 8.4.14 and tried Python 2.5. I tried with and without the suggested -fwrapv compiler option, and make gave me the same

Re: Problem installing cElementTree on Python 2.5

2007-01-10 Thread Klaas
Piet van Oostrum wrote: > I have just installed Python 2.5 on Mac OS X 10.4.8 on an iBook (PPC) from > the dmg. Now I tried to install cElementTree -1.0.5-20 from source (no egg > available in cheeseshop) and got the following compilation error: python2.5 ships with cElementTree: import xml.etree

Read from database, write to another database, simultaneously

2007-01-10 Thread Sean Davis
I am working on a simple script to read from one database (oracle) and write to another (postgresql). I retrieve the data from oracle in chunks and drop the data to postgresql continuously. The author of one of the python database clients mentioned that using one thread to retrieve the data from

Re: where to find the spec of format in PyObject_CallMethod

2007-01-10 Thread Huayang Xia
Thanks. I have mixed arguments. I found the format spec @ http://docs.python.org/api/arg-parsing.html On Jan 10, 5:31 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Wed, 2007-01-10 at 14:05 -0800, Huayang Xia wrote: > > I am trying to use PyObject_CallMethod. It needs a format string to > > sp

what is the idiom for copy lots of params into self?

2007-01-10 Thread Emin
Dear Experts, When writing large classes, I sometimes find myself needing to copy a lot of parameters from the argument of __init__ into self. Instead of having twenty lines that all basically say something like self.x = x, I often use __dict__ via something like: class example: def __init__

Re: Wierd M2Crypto bug - phony "peer did not return certificate" error

2007-01-10 Thread Heikki Toivonen
John Nagle wrote: > I have a little test case for M2Crypto, which just opens up SSL > connections to > web servers and reads their certificates. This works fine. > > But if I execute > > socket.setdefaulttimeout(5.0) Yup, this is a known problem, this breaks all M2Crypto code that uses sock

Re: Read from database, write to another database, simultaneously

2007-01-10 Thread Bjoern Schliessmann
Sean Davis wrote: > The author of one of the python database clients mentioned that > using one thread to retrieve the data from the oracle database and > another to insert the data into postgresql with something like a > pipe between the two threads might make sense, keeping both IO > streams bus

Re: Python - C# interoperability

2007-01-10 Thread sturlamolden
mc wrote: > Is there an easy way to compile a Python class (or set of classes) into > a .DLL that a C# program can call? Or otherwise to use an existing > library of Python classes from a C# program as seamlessly as possible? One way is to use IronPython if you don't need modules written for CPy

Re: Internet Survey

2007-01-10 Thread kkkisok
On 10-Jan-2007, krw <[EMAIL PROTECTED]> wrote: > ...and "HexaPussy" just wouldn't be right. SexagesimalPussy (base 60) has kind of a nice ring to it. -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the idiom for copy lots of params into self?

2007-01-10 Thread Jean-Paul Calderone
On 10 Jan 2007 14:46:54 -0800, Emin <[EMAIL PROTECTED]> wrote: >Dear Experts, > >When writing large classes, I sometimes find myself needing to copy a >lot of parameters from the argument of __init__ into self. Instead of >having twenty lines that all basically say something like self.x = x, I >oft

Re: what is the idiom for copy lots of params into self?

2007-01-10 Thread Steve Holden
Jean-Paul Calderone wrote: > On 10 Jan 2007 14:46:54 -0800, Emin <[EMAIL PROTECTED]> wrote: >> Dear Experts, >> >> When writing large classes, I sometimes find myself needing to copy a >> lot of parameters from the argument of __init__ into self. Instead of >> having twenty lines that all basically

Legally correct way of copying stdlib module?

2007-01-10 Thread Leif K-Brooks
I'm writing a package where I need to use the uuid module. Unfortunately, that module is only available in Python 2.5, and my package needs to be compatible with 2.4. I'm planning to copy it from Python 2.5's stdlib into my package, and import it like this: try: import uuid except ImportEr

How to use Mercurial for local source code management with a public Subversion server

2007-01-10 Thread Larry Hastings
I'm working on a patch or two for Python. Now, it's always best to use a source code manager (rcs, whatever) when writing code; in particular it'd make updating to the latest Python trees much easier. But I don't have write access to the Python Subversion repository. So I figured out how to wo

Re: what is the idiom for copy lots of params into self?

2007-01-10 Thread bearophileHUGS
Emin: > This saves a lot of code and makes it easier to see what is going on, > but it seems like there should be a better idiom for this task. Any > suggestions? I know two ways of doing it, one way requires very light code into the __init__ and it uses a decorator that takes the parameters and u

Re: what is the idiom for copy lots of params into self?

2007-01-10 Thread Luis M. González
Emin wrote: > Dear Experts, > > When writing large classes, I sometimes find myself needing to copy a > lot of parameters from the argument of __init__ into self. Instead of > having twenty lines that all basically say something like self.x = x, I > often use __dict__ via something like: > > class

IDLE Python and Environment Variables

2007-01-10 Thread Tristan
Hello community: I post this because I could not find satisfactory answers in the posts generated by this nice group. I work on winXP. I have many little python applications in different folders, each application can share or not other objects located in the same or other folders. The way I work t

IDLE Python and Environment Variables

2007-01-10 Thread Tristan
Hello community: I post this because I could not find satisfactory answers in the posts generated by this nice group. I work on winXP. I have many little python applications in different folders, each application can share or not other objects located in the same or other folders. The way I work t

Re: what is the idiom for copy lots of params into self?

2007-01-10 Thread [EMAIL PROTECTED]
def __init__(self, **kw): self.argdict = kw Emin wrote: > Dear Experts, > > When writing large classes, I sometimes find myself needing to copy a > lot of parameters from the argument of __init__ into self. Instead of > having twenty lines that all basically say something like self.x = x, I >

Re: Read from database, write to another database, simultaneously

2007-01-10 Thread johnf
Bjoern Schliessmann wrote: > Sean Davis wrote: > >> The author of one of the python database clients mentioned that >> using one thread to retrieve the data from the oracle database and >> another to insert the data into postgresql with something like a >> pipe between the two threads might make

Re: Evolving doctests for changing output format

2007-01-10 Thread Raymond Hettinger
[EMAIL PROTECTED] > What I'd like is if I could get doctest to take my tests, and > substitute the obtained output for the provided output. There's currently no support for auto-updating doctests. I think it would make for a good feature request. In the meantime, it may not be difficult to roll

Re: Maths error

2007-01-10 Thread Tim Peters
[Tim Peters] ... >> Huh. I don't read it that way. If it said "numbers can be ..." I >> might, but reading that way seems to requires effort to overlook the >> "decimal" in "decimal numbers can be ...". [Nick Maclaren] > I wouldn't expect YOU to read it that way, Of course I meant "putting my

globals accros modules

2007-01-10 Thread alf
Hi, executing main.py reulsts in following: [EMAIL PROTECTED] andy]$ python main.py Traceback (most recent call last): File "main.py", line 4, in ? amodule.f() File "/raid/home/andy/amodule.py", line 3, in f print a NameError: global name 'a' is not defined How can I have global

Re: SubProcess _make_inheritable

2007-01-10 Thread Gabriel Genellina
At Wednesday 10/1/2007 13:10, Roland Puntaier wrote: SubProcess.py needs to be patched - at least in 2.4 - to work from windows GUIs: def _make_inheritable(self, handle): """Return a duplicate of handle, which is inheritable""" if handle==None: handle=-1

Re: Universal Feed Parser - How do I keep attributes?

2007-01-10 Thread Gabriel Genellina
At Wednesday 10/1/2007 14:38, [EMAIL PROTECTED] wrote: >>> d = feedparser.parse('http://weather.yahooapis.com/forecastrss?p=94089') >>> d.feed.yweather_location u'' You have to feed it the *contents* of the page, not its URL. -- Gabriel Genellina Softlab SRL

Re: Newbie - converting csv files to arrays in NumPy - Matlab vs. Numpy comparison

2007-01-10 Thread Gabriel Genellina
At Wednesday 10/1/2007 16:48, oyekomova wrote: Thanks for your help. I compared the following code in NumPy with the csvread in Matlab for a very large csv file. Matlab read the file in 577 seconds. On the other hand, this code below kept running for over 2 hours. Can this program be made more e

Re: (newbie) Is there a way to prevent "name redundancy" in OOP ?

2007-01-10 Thread Michele Simionato
Martin v. Löwis wrote: > If you want to, you can combine this with the factory/singleton > patterns, to transparently create the objects on first access: > > class Registry: > def __getitem__(self, name): > # only invoked when attribute is not set > r = pin(name) > setattr(self, name,

Re: globals accros modules

2007-01-10 Thread Gabriel Genellina
At Thursday 11/1/2007 01:11, alf wrote: How can I have global globals without cyclical import? You can't. Globals are module globals. You need to qualify *which* module `a` belongs to. amodule.py: def f(): global a print a main.py: import

The Python Papers: Submit your Quotes

2007-01-10 Thread [EMAIL PROTECTED]
Volume Two of The Python Papers is on its way, and it would be great to get some more words from the community in there. Submit your own quotes to [EMAIL PROTECTED] to get a brief comment included in our next publication. Please include any attribution information you wish... Let's get the ball ro

Re: IDLE Python and Environment Variables

2007-01-10 Thread Gabriel Genellina
At Wednesday 10/1/2007 23:24, Tristan wrote: 1) For almost everyone, I execute a corresponding ".bat file" into which I define and/or include values for some "temporal" environment variables that let me find all the objects that the selected application uses. Sometimes I include in the .ba

Re: Is there a way to protect a piece of critical code?

2007-01-10 Thread Hendrik van Rooyen
"robert" <[EMAIL PROTECTED]> wrote: > Hendrik van Rooyen wrote: > > Hi, > > > > I would like to do the following as one atomic operation: > > > > 1) Append an item to a list > > 2) Set a Boolean indicator > > > I doubt you have to worry at all about this in such simple single-single queue - if the

Re: Is there a way to protect a piece of critical code?

2007-01-10 Thread Hendrik van Rooyen
"Paul Rubin" wrote: > "Hendrik van Rooyen" <[EMAIL PROTECTED]> writes: > > I would like to do the following as one atomic operation: > > > > 1) Append an item to a list > > 2) Set a Boolean indicator > > You could do it with locks as others have suggested, but maybe

Re: Is there a way to protect a piece of critical code?

2007-01-10 Thread Paul Rubin
"Hendrik van Rooyen" <[EMAIL PROTECTED]> writes: > am aware of Queue module - the same app uses it for something else. > I dont like too many try -- excepts in the code - I find they confuse > me when I try to read it later - and in this case I cannot block on waiting > for > the queue to fill. D

Re: Is there a way to protect a piece of critical code?

2007-01-10 Thread Hendrik van Rooyen
"Steve Holden" <[EMAIL PROTECTED]> wrote: > Hendrik van Rooyen wrote: > > Hi, > > > > I would like to do the following as one atomic operation: > > > > 1) Append an item to a list > > 2) Set a Boolean indicator > > > > It would be almost like getting and holding the GIL, > > to prevent a thre

Re: Is there a way to protect a piece of critical code?

2007-01-10 Thread Paul Rubin
Paul Rubin writes: > def get_from_queue(queue): >try: > return queue.get(block=False) >except Queue.Empty: > return QUEUE_IS_EMPTY Alternatively: def get_from_queue(queue): try: return (queue.get(block=Fals

Re: Python 2.5 install on Gentoo Linux: failed dmb and _tkinter

2007-01-10 Thread Martin v. Löwis
Sorin Schwimmer schrieb: > *** WARNING: renaming "_tkinter" since importing it > failed: libtk8.4.so: cannot open shared object file: > No such file or directory > running build_scripts > > I have libtk: > > # ls -l /usr/local/lib/libtk8.4.so > -r-xr-xr-x 1 root root 906285 Jan 10 16:08 > /usr/lo

Joining threads but allowing signals to main thread?

2007-01-10 Thread Lloyd Zusman
I have a python-2.5 program running under linux in which I spawn a number of threads. The main thread does nothing while these subsidiary threads are running, and after they all complete, the main thread will then exit. I know that I can manage this through the use of Thread.join(), but when I do

Urgent Openings with the World's Leading Software Company !!!

2007-01-10 Thread Software Hiring
Hi Friends, Hope you're doing great. We are looking for Software Professionals with about 7 years of experience and willing to work for the World's Biggest Software Company - Microsoft. We have a variety of jobs across different verticals at Microsoft India Development Center (MSIDC) based at HIT

Re: Joining threads but allowing signals to main thread?

2007-01-10 Thread Gabriel Genellina
At Thursday 11/1/2007 03:43, Lloyd Zusman wrote: while threading.activeCount() > 1: time.sleep(0.001) sys.exit(0) Is there any way to allow my program to respond to signals without having to busy-wait in the main thread? Don't worry too much, this is *not* a busy wait, because you

Re: how to clean sys.path

2007-01-10 Thread Tim Roberts
"siggi" <[EMAIL PROTECTED]> wrote: > >when I do >>>sys.path in IDLE (winXP), i get a horrendously long list of >paths, paths I may have used during a lot of trials and errors. How can I >clean up sys.path? I mean, trim it of unnecessary paths? What do mean by "used during a lot of trials and err

Print message with Colors

2007-01-10 Thread prk
Hi Folks, Is there any procesure for print messages with colors. Ex: print "Welcome" Comment: Here i want to see the welcome message in Red Color. Regards, Ram -- http://mail.python.org/mailman/listinfo/python-list

Re: Urgent Openings with the World's Leading Software Company !!!

2007-01-10 Thread Terry Reedy
(cc'ed) "Software Hiring" <[EMAIL PROTECTED]> wrote Hi Vamsi. Recruiting for Microsoft gives you no extra right to spam comp.lang.python with off-topic messages. There are thousands of other software groups that might like to do the same but with a couple of exceptions a year, they all desi

<    1   2