Re: when should I explicitly close a file?

2010-04-24 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 23 Apr 2010 13:19:41 +0200, Alf P. Steinbach wrote: But for a literal context-free interpretation e.g. the 'sys.getrefcount' function is not documented as CPython only and thus an implementation that didn't do reference counting would not be a conforming Python implem

Re: DLLs loading in interpreter but not with direct run on Windows

2010-04-24 Thread Michel Claveau - MVP
Hi! AMHA (IMO), it is PyQT4 who change the DLL loader... @+ -- MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: socked and bytes operation

2010-04-24 Thread luca72
i attach some part of the server so maybe you can help me to understand : Packet description (before encryption) Messages sent back and forth between newcamd and a cardserver always consist of a three byte header and (optional) data bytes. The header always starts with a command tag byte. This i

Re: NotImplemented used in Decimal

2010-04-24 Thread Steven D'Aprano
On Fri, 23 Apr 2010 23:51:39 -0700, Chris Rebert wrote: > If the conversion to Decimal in _convert_other() fails, the operator > method returns NotImplemented to signal to the interpreter that Decimal > doesn't know how to do the requested operation with an operand of the > given type; the interp

NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
I wanted to do something like this: while True: try: def fun(a, b=b, c=c): pass except NameError as ne: name = get_the_var_name(ne) locals()[name] = '' else: break What's be best way to implement the function get_the_var_name(ne) that returns the name of the variable that could

MySQLdb - weird formatting inconsistency

2010-04-24 Thread Anthra Norell
Hi all, Can anyone explain this? Three commands with three different cutoff dates (12/30, 12/31 and 1/1) produce a formatting inconsistency. Examine the third field. The first and last run represents it correctly. The second run strips it. The field happens to be a record ID and getting it

Re: NameError: how to get the name?

2010-04-24 Thread James Mills
On Sat, Apr 24, 2010 at 9:19 PM, Yingjie Lan wrote: > I wanted to do something like this: > > while True: >  try: >    def fun(a, b=b, c=c): pass >  except NameError as ne: >    name = get_the_var_name(ne) >    locals()[name] = '' >  else: break > > What's be best way to implement the function > g

Re: NameError: how to get the name?

2010-04-24 Thread Steven D'Aprano
On Sat, 24 Apr 2010 04:19:43 -0700, Yingjie Lan wrote: > I wanted to do something like this: > > while True: > try: > def fun(a, b=b, c=c): pass > except NameError as ne: > name = get_the_var_name(ne) > locals()[name] = '' > else: break This won't work. Writing to locals() does

Re: On Class namespaces, calling methods

2010-04-24 Thread Lie Ryan
On 04/24/10 06:07, Aahz wrote: > In article <4bc120bd$0$8850$c3e8...@news.astraweb.com>, > Steven D'Aprano wrote: >> >> I can only think of two circumstances where old-style classes are >> *wrong*: if you use multiple inheritance with a diamond diagram ("...now >> you have THREE problems" *wink

Re: ctypes: delay conversion from c_char_p to string

2010-04-24 Thread Thomas Heller
Brendan Miller schrieb: > I have a function exposed through ctypes that returns a c_char_p. > Since I need to deallocate that c_char_p, it's inconvenient that > ctypes copies the c_char_p into a string instead of giving me the raw > pointer. I believe this will cause a memory leak, unless ctypes is

Re: Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-24 Thread DarkBlue
On Apr 22, 4:55 pm, joamag wrote: > Does anybody know a cross platform way to retrieve the default DNS > server IP address in python ? > > Thanks ! > João import os,urllib2,re def getIpAddr(): """ Function for parsing external ip adress by pinging dyndns.com """ External_IP=url

Re: NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
--- On Sat, 4/24/10, Steven D'Aprano wrote: > From: Steven D'Aprano > Subject: Re: NameError: how to get the name? > To: python-list@python.org > Date: Saturday, April 24, 2010, 4:07 PM > On Sat, 24 Apr 2010 04:19:43 -0700, > Yingjie Lan wrote: > > > I wanted to do something like this: > > >

Re: NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
--- On Sat, 4/24/10, James Mills wrote: > From: James Mills > Subject: Re: NameError: how to get the name? > To: "Yingjie Lan" > Cc: "python list" > Date: Saturday, April 24, 2010, 4:03 PM > On Sat, Apr 24, 2010 at 9:19 PM, > Yingjie Lan > wrote: > > I wanted to do something like this: > > >

Reminder: 6 days left for EuroPython 2010 talk submissions

2010-04-24 Thread Alex Willmer
The EuroPython 2010 call for papers closes this Friday on 30th April. We've already had many submissions covering Python 3, Python 2.7, IronPython, Game Programming, Testing, Behavior Driven Development, NoSQL, Accessiblilty and others. We still are looking for talks and tutorials on Django, PyPy,

Re: NameError: how to get the name?

2010-04-24 Thread Gary Herron
Yingjie Lan wrote: --- On Sat, 4/24/10, Steven D'Aprano wrote: From: Steven D'Aprano Subject: Re: NameError: how to get the name? To: python-list@python.org Date: Saturday, April 24, 2010, 4:07 PM On Sat, 24 Apr 2010 04:19:43 -0700, Yingjie Lan wrote: I wanted to do something like

Re: DLLs loading in interpreter but not with direct run on Windows

2010-04-24 Thread TerryP
On Apr 23, 4:47 pm, JTimoty wrote: > Hi, > > I've got a weird problem, apparently related to the way python > searches for DLLs on Windows. > > I compiled PyQt4 (no errors) but scripts that use it fail with "DLL > load failed: Invalid access to memory location." > If I play with loading the module

Abstract attributes

2010-04-24 Thread Raymond Wynne
I was coding a simple abstract class for a database interface for a library I am writing. However, it occurred to me that you can't ask for a simple "abstract attribute", an attribute that is required for the class. Now, that could be implemented as a property, but a getter that merely returns a

Re: MySQLdb - weird formatting inconsistency

2010-04-24 Thread Sebastian Bassi
Hi, Could you post a minimal version of the DB (a DB dump) to test it? Just remove most information and leave on the ones needed to reproduce the error. Also remove any personal/confidential information. Then dump the DB so I can test it here. Best, SB. -- http://mail.python.org/mailman/listinfo/

Re: MySQLdb - weird formatting inconsistency

2010-04-24 Thread John Nagle
Anthra Norell wrote: Hi all, Can anyone explain this? Three commands with three different cutoff dates (12/30, 12/31 and 1/1) produce a formatting inconsistency. Examine the third field. The first and last run represents it correctly. The second run strips it. The field happens to be a rec

help require debugging C/C++ extension modules written for Python (ubuntu)

2010-04-24 Thread michel parker
Hi, Can you please guide me in selecting a tool (ide) that would debug python and C/C++ extension modules written for Python at a same time? Regards,Michell _ Hotmail: Powerful Free email

Re: MySQLdb - weird formatting inconsistency

2010-04-24 Thread Anthra Norell
Anthra Norell wrote: Sebastian Bassi wrote: Hi, Could you post a minimal version of the DB (a DB dump) to test it? Just remove most information and leave on the ones needed to reproduce the error. Also remove any personal/confidential information. Then dump the DB so I can test it here. Best, S

Wanted: Python solution for ordering dependencies

2010-04-24 Thread Jonathan Fine
Hi I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is processed. I think I could get what I want by writing and running a suitable makefile, but t

Re: Wanted: Python solution for ordering dependencies

2010-04-24 Thread Chris Rebert
On Sat, Apr 24, 2010 at 1:53 PM, Jonathan Fine wrote: > Hi > > I'm hoping to avoid reinventing a wheel (or other rolling device).  I've got > a number of dependencies and, if possible, I want to order them so that each > item has its dependencies met before it is processed. > > I think I could get

Re: NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
--- On Sat, 4/24/10, Gary Herron wrote: > From: Gary Herron > Subject: Re: NameError: how to get the name? > To: > Cc: python-list@python.org > Date: Saturday, April 24, 2010, 8:03 PM > Yingjie Lan wrote: > > --- On Sat, 4/24/10, Steven D'Aprano > wrote: > > > > > >> From: Steven D'Aprano

Re: NameError: how to get the name?

2010-04-24 Thread Chris Rebert
On Sat, Apr 24, 2010 at 4:17 PM, Yingjie Lan wrote: > --- On Sat, 4/24/10, Gary Herron wrote: >> From: Gary Herron >> Date: Saturday, April 24, 2010, 8:03 PM >> Yingjie Lan wrote: >> > --- On Sat, 4/24/10, Steven D'Aprano >> wrote: >> >> From: Steven D'Aprano >> >> Subject: Re: NameError: how

Re: [Python3] Reading a binary file and wrtiting the bytes verbatim in an utf-8 file

2010-04-24 Thread Antoine Pitrou
Hello, > I have to read the contents of a binary file (a PNG file exactly), and > dump it into an RTF file. > > The RTF-file has been opened with codecs.open in utf-8 mode. You should use the built-in open() function. codecs.open() is outdated in Python 3. > As I expected, the utf-8 decoder c

Re: On Class namespaces, calling methods

2010-04-24 Thread Aahz
In article <4bd2e20...@dnews.tpgi.com.au>, Lie Ryan wrote: >On 04/24/10 06:07, Aahz wrote: >> In article <4bc120bd$0$8850$c3e8...@news.astraweb.com>, >> Steven D'Aprano wrote: >>> >>> I can only think of two circumstances where old-style classes are >>> *wrong*: if you use multiple inheritance

Re: Wanted: Python solution for ordering dependencies

2010-04-24 Thread Aahz
In article , Jonathan Fine wrote: > >I'm hoping to avoid reinventing a wheel (or other rolling device). I've >got a number of dependencies and, if possible, I want to order them so >that each item has its dependencies met before it is processed. > >I think I could get what I want by writing an

py2exe breaking wxPython?

2010-04-24 Thread Alex Hall
Hello all, I have a compiled version of my project, but the wx functions do not work. When run from the python source, instead of the compiled .exe file, wx works as expected. I am including msvcr90.dll in the dist folder. I looked for answers on Google, but I could not really follow the tutorials

Re: py2exe breaking wxPython?

2010-04-24 Thread John Bokma
Alex Hall writes: > Hello all, > I have a compiled version of my project, but the wx functions do not > work. When run from the python source, instead of the compiled .exe > file, wx works as expected. I am including msvcr90.dll in the dist > folder. I looked for answers on Google, but I could no

question about google project hosting!

2010-04-24 Thread zhengqing
Hi, is there any one know some python libraries to check if there is a new download for a google project hosting project? or are there any API which has such kind of function? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: question about google project hosting!

2010-04-24 Thread Chris Rebert
On Sat, Apr 24, 2010 at 9:11 PM, zhengqing wrote: >    is there any one know some python libraries to check if there is a > new download for a google project hosting project? >    or are there any API which has such kind of function? You could use the Universal Feed Parser (http://www.feedparser.

exceptions from daemon threads which access the global namespace at interpreter shutdown (how to squelch output?)

2010-04-24 Thread Ben Cohen
I've got an application which makes fairly heavy use of daemon threads to perform 'background' processing and various other long-running tasks that are likely to block. My original understanding of threading.Thread's daemon threads was that I could safely fire them off and essentially forget ab

☆☉☉☆ Barely Legal Babes - Free downloads! V ideos Images, Barely Legal young teens

2010-04-24 Thread Custhelp
☆☉☉☆ Barely Legal Babes - Free downloads! Videos Images, Barely Legal young teens http://liquid-cash.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
--- On Sun, 4/25/10, Chris Rebert wrote: > From: Chris Rebert > Subject: Re: NameError: how to get the name? > To: "Yingjie Lan" > Cc: python-list@python.org > Date: Sunday, April 25, 2010, 3:27 AM > On Sat, Apr 24, 2010 at 4:17 PM, > Yingjie Lan > wrote: > > --- On Sat, 4/24/10, Gary Herron

Re: [Python3] Reading a binary file and wrtiting the bytes verbatim in an utf-8 file

2010-04-24 Thread Stefan Behnel
Antoine Pitrou, 25.04.2010 02:16: Another possibility is to open the file in binary mode and do the encoding yourself when writing text. This might actually be a better solution, since I'm not sure RTF uses utf-8 by default. That's a lot cleaner as it doesn't use two interfaces to write to the

Re: NameError: how to get the name?

2010-04-24 Thread Chris Rebert
On Sat, Apr 24, 2010, Yingjie Lan wrote: > On Sun, 4/25/10, Chris Rebert wrote: >> On Sat, Apr 24, 2010, Yingjie Lan wrote: >> > On Sat, 4/24/10, Gary Herron wrote: >> >> Yingjie Lan wrote: >> >> > On Sat, 4/24/10, Steven D'Aprano wrote: >> >> >> On Sat, 24 Apr 2010, Yingjie Lan wrote: >> >> >

Re: NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
--- On Sun, 4/25/10, Chris Rebert wrote: > From: Chris Rebert > Subject: Re: NameError: how to get the name? > To: "Yingjie Lan" > Cc: "python list" > Date: Sunday, April 25, 2010, 10:09 AM > On Sat, Apr 24, 2010, Yingjie Lan > > wrote: > > On Sun, 4/25/10, Chris Rebert > wrote: > >> On Sat,

Re: how to debug python application crashed occasionally

2010-04-24 Thread jacky wang
could anyone help me? On Apr 21, 2:55 pm, jacky wang wrote: > Hello > >   recently, I met a problem with one python application running with > python2.5 | debian/lenny adm64 system: it crashed occasionally in our > production environment. The problem started to happen just after we > upgraded th