Re: Returning a value from exec or a better solution

2011-08-30 Thread Arnaud Delobelle
On 30 August 2011 22:48, Rob Williscroft wrote: > Arnaud Delobelle wrote in > news:CAJ6cK1YVi3NQgdZOUdhAESf133pUkdazM1PkSP=p6xfayvo...@mail.gmail.com in > gmane.comp.python.general: > >> On 30 August 2011 13:31, Jack Trades wrote: >>> >>> >>> On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrot

Re: Help parsing a text file

2011-08-30 Thread Tim Roberts
William Gill wrote: > >My initial passes into Python have been very unfocused (a scatter gun of >too many possible directions, yielding very messy results), so I'm >asking for some suggestions, or algorithms (possibly even examples)that >may help me focus. > >I'm not asking anyone to write my c

Re: Python IDE/Eclipse

2011-08-30 Thread Adam Jorgensen
I recommend PyCharm. Best Python IDE ever :-) If you can't afford to pay for it in the long run, then PyDev is the next best bet. I would recommend downloading the most minimal Eclipse you can get (Usually the Eclipse RCP Runtime) and install the necessary plugins as you go. This prevents you from

Re: Usage of PyDateTime_FromTimestamp

2011-08-30 Thread Andreas
Am 30.08.2011 23:49, schrieb MRAB: > The key phrase is "argument tuple". The arguments passed to a Python > call are always a tuple, not PyFloat_Object. > > You can build a tuple from the PyFloat_Object using: > > Py_BuildValue("(O)", float_object) > > The "(O)" says to build a tuple ("(...

Re: Handling 2.7 and 3.0 Versions of Dict

2011-08-30 Thread Terry Reedy
On 8/30/2011 9:43 PM, Travis Parks wrote: I am writing a simple algorithms library that I want to work for both Python 2.7 and 3.x. I am writing some functions like distinct, which work with dictionaries under the hood. The problem I ran into is that I am calling itervalues or values depending on

Handling 2.7 and 3.0 Versions of Dict

2011-08-30 Thread Travis Parks
I am writing a simple algorithms library that I want to work for both Python 2.7 and 3.x. I am writing some functions like distinct, which work with dictionaries under the hood. The problem I ran into is that I am calling itervalues or values depending on which version of the language I am working

Re: Installing WebDAV server

2011-08-30 Thread Thomas 'PointedEars' Lahn
Fokke Nauta wrote: > "Thomas 'PointedEars' Lahn" wrote in message > news:6545843.yvfaxzv...@pointedears.de... It's attribution _line_, not attribution novel. Your quotes are hardly legible, too → >> Fokke Nauta wrote: >>> I'm running a PC with XP Pro32, [.] >>> […] In t

Re: Python IDE/Eclipse

2011-08-30 Thread Fabio Zadrozny
On Fri, Aug 26, 2011 at 11:18 AM, Dave Boland wrote: > I'm looking for a good IDE -- easy to setup, easy to use -- for Python.  Any > suggestions? > > I use Eclipse for other projects and have no problem with using it for > Python, except that I can't get PyDev to install.  It takes forever, then

Re: Returning a value from exec or a better solution

2011-08-30 Thread Jack Trades
On Tue, Aug 30, 2011 at 1:19 PM, Ethan Furman wrote: > > I spoke a bit too soon with the "works flawlessly" post. In addition to >> your issue, there is also the problem that supplying an empty environment >> does not allow the user to call necessary functions (like scheme_eval). >> > > > So, ju

Re: Returning a value from exec or a better solution

2011-08-30 Thread Ethan Furman
Rob Williscroft wrote: Arnaud Delobelle wrote: That's not an issue. The last statement that is executed will be the "def" statement. You don't know that, an implementation may for example set __bultins__ to None, prior to returning, its not an unreasonable thing to do and the docs don't say

Re: Returning a value from exec or a better solution

2011-08-30 Thread Ethan Furman
Rob Williscroft wrote: Arnaud Delobelle wrote: That's not an issue. The last statement that is executed will be the "def" statement. You don't know that, an implementation may for example set __bultins__ to None, prior to returning, its not an unreasonable thing to do and the docs don't say

Re: Usage of PyDateTime_FromTimestamp

2011-08-30 Thread MRAB
On 30/08/2011 21:42, Andreas wrote: Hi, I'm working on a c-extension of python and want to create an instance of python datetime object with a unix timestamp in c. On the documentation site ( http://docs.python.org/c-api/datetime.html ) I found the function PyDateTime_FromTimestamp() which retu

Re: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Arnaud Delobelle wrote in news:CAJ6cK1YVi3NQgdZOUdhAESf133pUkdazM1PkSP=p6xfayvo...@mail.gmail.com in gmane.comp.python.general: > On 30 August 2011 13:31, Jack Trades wrote: >> >> >> On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: >> >>> >>> > That's brilliant and works flawlessly. ¶ÿT

Access LDAP with Django

2011-08-30 Thread John Riselvato
Would Django be a good framework to use if i wanted to take directories of LDAP and make a list of users on a website? I have seen it done in php, but what about trying to manage this with django? -- http://mail.python.org/mailman/listinfo/python-list

RE: Get reference to parent class from subclass?

2011-08-30 Thread Prasad, Ramit
-Original Message- From: python-list-bounces+ramit.prasad=jpmorgan@python.org [mailto:python-list-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of John O'Hagan Sent: Saturday, August 27, 2011 11:00 PM To: python-list@python.org Subject: Get reference to parent class from sub

Re: Installing WebDAV server

2011-08-30 Thread Fokke Nauta
"Thomas 'PointedEars' Lahn" wrote in message news:6545843.yvfaxzv...@pointedears.de... > Fokke Nauta wrote: > >> I'm running a PC with XP Pro32, [.] >> To do some research with some calender systems and to share the Outlook >> calendar I need a WebDAV server. After googling I found the Python Web

Re: Returning a value from exec or a better solution

2011-08-30 Thread Arnaud Delobelle
On 30 August 2011 13:31, Jack Trades wrote: > > > On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: > >> >> > That's brilliant and works flawlessly.  Thank you very much! >> >> If an impementation (as you say up thread) can populate globals >> or locals with whatever they want, then how do

Python Tools for Visual Studio - anyone using it?

2011-08-30 Thread Philip Semanchuk
Hi all, I was reminded today (via Slashdot) of Python Tools for Visual Studio which was discussed on this list back in March (http://mail.python.org/pipermail/python-list/2011-March/1267662.html) and has reached version 1.0. Is anyone here using it? Care to share pros & cons? Here's the URL for

Re: Returning a value from exec or a better solution

2011-08-30 Thread Ethan Furman
Rob Williscroft wrote: Ethan Furman wrote in news:4e5d29c8.8010...@stoneleaf.us in gmane.comp.python.general: Jack Trades wrote: On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: If an impementation (as you say up thread) can populate globals or locals with whatever they want, then how

Usage of PyDateTime_FromTimestamp

2011-08-30 Thread Andreas
Hi, I'm working on a c-extension of python and want to create an instance of python datetime object with a unix timestamp in c. On the documentation site ( http://docs.python.org/c-api/datetime.html ) I found the function PyDateTime_FromTimestamp() which returns a new reference based on an input

Re: Installing WebDAV server

2011-08-30 Thread Thomas 'PointedEars' Lahn
Fokke Nauta wrote: > I'm running a PC with XP Pro32, […] > To do some research with some calender systems and to share the Outlook > calendar I need a WebDAV server. After googling I found the Python WebDAV > server. > I installed Python 3.2.1 and extracted the packages PyWebDAV and PyXML. > Now I

Installing WebDAV server

2011-08-30 Thread Fokke Nauta
Hi all, I am completely new to Python, but I'm confronted with a problem I can't solve. This is my question: I'm running a PC with XP Pro32, which acts as a file server/print server/FTP server and web server. The web server is facilitated by the Aprelium Abyss X2 server, and has Perl and PHP s

Re: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Ethan Furman wrote in news:4e5d29c8.8010...@stoneleaf.us in gmane.comp.python.general: > Jack Trades wrote: >> On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: >>> If an impementation (as you say up thread) can populate globals >>> or locals with whatever they want, then how do you know th

Re: Returning a value from exec or a better solution

2011-08-30 Thread Ethan Furman
Jack Trades wrote: On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: If an impementation (as you say up thread) can populate globals or locals with whatever they want, then how do you know that last item added was the function definition the user supplied ? Because the implementation wil

can't create instance of pythoncom server

2011-08-30 Thread Johanna
Hi all, I am trying to consume a Pythoncom server from 3ds max. I need this to be able to call some mysql queries in python script from maxscript. I tried to follow the steps in this article. I created a small pythoncom server import sys, os def getWorkingDirectory() : return os.path.dirname

SQLObject 1.1.3

2011-08-30 Thread Oleg Broytman
Hello! I'm pleased to announce version 1.1.3, a bugfix release of branch 1.1 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use

Re: Unpickle error -- "object has no attribute ...."

2011-08-30 Thread Peter Otten
luvspython wrote: > THANK YOU! Special-casing "__dict__" did the trick. Not sure I'd > have ever figured that out, which leads to a different question: > > I can figure out most things, though perhaps very slowly and > painfully, if I can trace through code. I use WingIDE (love it), but > the

Re: Help me understand this logging config

2011-08-30 Thread Roy Smith
In article , Peter Otten <__pete...@web.de> wrote: > Roy Smith wrote: > > > I'm using django 1.3 and python 2.6. > > Isn't dictConfig() new in 2.7? It looks like that is what you are using... Oh, my, it turns out that django includes: # This is a copy of the Python logging.config.dictconfig m

Re: Returning a value from exec or a better solution

2011-08-30 Thread Jack Trades
On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: > > That's brilliant and works flawlessly. Thank you very much! > > If an impementation (as you say up thread) can populate globals > or locals with whatever they want, then how do you know that last > item added was the function definitio

Re: Making `logging.basicConfig` log to *both* `sys.stderr` and `sys.stdout`?

2011-08-30 Thread Michel Albert
On Aug 30, 11:45 am, Peter Otten <__pete...@web.de> wrote: > Michel Albert wrote: > > I use python oftentimes to write automation scripts on Linux servers. > > And there's a big pattern in my scripts: > > > - I *always* use `logging` instead of `print` statements. > > - I *always* create two stream

Re: Help parsing a text file

2011-08-30 Thread Waldek M.
On Mon, 29 Aug 2011 23:05:23 +0200, Thomas Jollans wrote: > A name that is often thrown around on this list for this kind of > question is pyparsing. Now, I don't know anything about it myself, but > it may be worth looking into. Definitely. I did use it and even though it's not perfect - it's ver

Re: Help me understand this logging config

2011-08-30 Thread anand jeyahar
Hi, I took a look at the logging source code. getLogger checks for existing loggers with the given name and if it doesn't creates one. def getLogger(self, name): """ Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is

Re: killing a script

2011-08-30 Thread Hans Mulder
On 30/08/11 06:13:41, Steven D'Aprano wrote: On Tue, 30 Aug 2011 08:53 am Arnaud Delobelle wrote: [...] Yes, but if I am not mistaken, that will require me to put a line or two after each os.system call. That's almost like whack-a-mole at the code level rather than the Control-C level. OK, not

Re: Making `logging.basicConfig` log to *both* `sys.stderr` and `sys.stdout`?

2011-08-30 Thread Peter Otten
Michel Albert wrote: > I use python oftentimes to write automation scripts on Linux servers. > And there's a big pattern in my scripts: > > - I *always* use `logging` instead of `print` statements. > - I *always* create two stream handlers. One for `sys.stdout` with > level `INFO` and one for `sy

Re: Help me understand this logging config

2011-08-30 Thread Peter Otten
Roy Smith wrote: > I'm using django 1.3 and python 2.6. Isn't dictConfig() new in 2.7? It looks like that is what you are using... > My logging config is: > > > LOGGING = { > 'version': 1, > 'disable_existing_loggers': False, > 'formatters': { > 'verbose': { > '

Making `logging.basicConfig` log to *both* `sys.stderr` and `sys.stdout`?

2011-08-30 Thread Michel Albert
Hi, I use python oftentimes to write automation scripts on Linux servers. And there's a big pattern in my scripts: - I *always* use `logging` instead of `print` statements. - I *always* create two stream handlers. One for `sys.stdout` with level `INFO` and one for `sys.stderr` with level `WARN`

Re: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Jack Trades wrote in news:CAG5udOiOAge3uHrGSDTZ412GAg+CC- 6u8igoyj0lnf3hnwu...@mail.gmail.com in gmane.comp.python.general: >> >>> class CapturingDict(dict): >> ... def __setitem__(self, key, val): >> ... self.key, self.val = key, val >> ... dict.__setitem__(self, key, val) >>

Re: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Jack Trades wrote in news:CAG5udOh1+oE4g9Frjp3pucbHUtWcN34KK35a-Xs2YqkZH9X5=w...@mail.gmail.com in gmane.comp.python.general: >> def test(): >> src = ( >> "def double(x):" >> " return x * 2" >> ) >> globals = {} >> exec( src, globals ) >> return globals[ "double" ] >> >> prin