Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Steven D'Aprano
Andrew Berg wrote: > I'm not sure the subject's wording is the best, but I'll try to explain. > I have a main script that imports several modules and I need to be able > to call methods from a class instance inside that main script from a > module. Currently, functions can be defined to access the

question on installing python 2.7.2 and tcl 8.5.10 on WinXP

2011-10-02 Thread Lynn Oliver
Hello, I'm having problems building tcl/tk and python on Windows XP so that both are installed correctly. 1. ActivePython 2.7.2.5 works fine on my system but may be implicated in recent R6034 runtime errors from users. 2. Python.org 2.7.2 msi binaries install fine, but produce a "tcl wasn't i

Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Andrew Berg
On 2011.10.02 01:55 AM, Steven D'Aprano wrote: > Have I missed something? Why can't you just import the module and call the > methods like you would for any other module and class? > > import module > instance = module.Some_Class() > result = instance.method(some, arguments, may, be, needed) I nee

Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Andrew Berg
On 2011.10.02 02:11 AM, Gary Herron wrote: > You may be able to do the simplest thing: If a module wants to call > something form the main module (or main script as you call it) just try > importing that main script and call whatever it is you want. This > results in a circular set of imports,

Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Steven D'Aprano
Andrew Berg wrote: > On 2011.10.02 01:55 AM, Steven D'Aprano wrote: >> Have I missed something? Why can't you just import the module and call >> the methods like you would for any other module and class? >> >> import module >> instance = module.Some_Class() >> result = instance.method(some, argum

Re: executing arbitrary statements

2011-10-02 Thread Jonathan Hartley
On Saturday, October 1, 2011 8:06:43 AM UTC+1, Chris Rebert wrote: > On Fri, Sep 30, 2011 at 11:31 PM, Jason Swails wrote: > > I'm probably missing something pretty obvious, but I was wondering if there > > was a way of executing an arbitrary line of code somehow (such as a line of > > code based

Re: executing arbitrary statements

2011-10-02 Thread Steven D'Aprano
Jonathan Hartley wrote: > I (and many others) entirely avoid using 'eval' in all my code for many > years, based on the security concerns that Chris rightly highlights. It's > worth noting though, that RaymondH's talks last year on some valid uses of > 'eval' and 'exec' have opened my eyes to it s

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-02 Thread rusi
On Oct 2, 8:03 am, Steven D'Aprano wrote: > By the way, who removed the OT label from the subject line? Please don't > unless it actually comes back on topic. > > DevPlayer wrote: > > I still assert that contradiction is caused by narrow perspective. > > There's no doubt that some *apparent* contr

Replacing spreadsheets by Python and the browser

2011-10-02 Thread markolopa
Hello, Could you please recommend me a Python tool that could help me to get rid of the messy information and scripts I have in spreadsheets? Spreadsheets are great for having simple things done quickly. But as the needs grow their limitations can be quite frustrating. I would like to use the bro

Re: Replacing spreadsheets by Python and the browser

2011-10-02 Thread Andrea Crotti
On 10/02/2011 06:36 PM, markolopa wrote: Hello, Could you please recommend me a Python tool that could help me to get rid of the messy information and scripts I have in spreadsheets? Spreadsheets are great for having simple things done quickly. But as the needs grow their limitations can be qui

Re: Replacing spreadsheets by Python and the browser

2011-10-02 Thread rusi
On Oct 2, 10:36 pm, markolopa wrote: > Hello, > > Could you please recommend me a Python tool that could help me to get > rid of the messy information and scripts I have in spreadsheets? > > Spreadsheets are great for having simple things done quickly. But as > the needs grow their limitations can

Adding new keywords to Python interpreter

2011-10-02 Thread Yaşar Arabacı
Hi people, Nowadays, I am trying to explore python source. I added a new keyword, essentially doing same thing as 'continue' keyword to the interpreter, mostly by following instructions in PEP 306. If anyone interested here is the video about how I did it: http://www.youtube.com/watch?v=Ww7BeIdUb

Re: Replacing spreadsheets by Python and the browser

2011-10-02 Thread rantingrick
On Oct 2, 12:36 pm, markolopa wrote: > Examples of information I would store in such a tree/table system > (which are now in spreasheets): > - My dvd, avi collection: The tree would be the directory tree of the > file system where I store my movies. For each directory containing the > avis or the

Re: Replacing spreadsheets by Python and the browser

2011-10-02 Thread python
Check out ResolverOne http://www.resolversystems.com Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Change import order with *.pth files

2011-10-02 Thread Andrea Gavana
Hi All, my apologies if this is a dumb question, but I couldn't find a solution - possibly because I am not sure how to state my problem in a short sentence. Let's say I am using a package called "blah", and this package is already installed on site-packages (and I need it to be there) with

[OT] Re: Chaos Theory [was Re: Benefit and belief]

2011-10-02 Thread Steven D'Aprano
On Sun, 02 Oct 2011 08:03:07 -0700, rusi wrote: > On Oct 2, 8:03 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> By the way, who removed the OT label from the subject line? Please >> don't unless it actually comes back on topic. >> >> DevPlayer wrote: >> > I still assert that contr

Re: Change import order with *.pth files

2011-10-02 Thread Andrea Crotti
On 10/02/2011 10:29 PM, Andrea Gavana wrote: Hi All, my apologies if this is a dumb question, but I couldn't find a solution - possibly because I am not sure how to state my problem in a short sentence. Let's say I am using a package called "blah", and this package is already installed

getattr and method name

2011-10-02 Thread Kevin Walzer
I'm seeing a very odd error in an application I'm developing using Python 2.7.2, on Mac OS 10.7. This application uses a wrapper method to look up other method names via getattr and then call those methods. I have not previously had an issue with this name, but for some reason this functionali

Advise on using logging.getLogger needed.

2011-10-02 Thread Steven W. Orr
I hope I don't sound like I'm ranting :-( I have created a module (called xlogging) which sets up logging the way I want it. I found out that if I set up my logger without a name, then it gets applied to every logger that is referenced by every module that ever gets imported. The problem is that

Re: TK + MVC

2011-10-02 Thread Emeka
Greg, Do you have an example where the Controller is connected? Regards, EMeka On Sun, Oct 2, 2011 at 4:40 AM, Gregory Ewing wrote: > Alexander Kapps wrote: > > But I think a simple (and quick 'n' dirty) Tk MVC example can look like >> this: >> > > The Controller doesn't seem to add any value

Re: getattr and method name

2011-10-02 Thread Chris Rebert
On Sun, Oct 2, 2011 at 3:02 PM, Kevin Walzer wrote: > I'm seeing a very odd error in an application I'm developing using Python > 2.7.2, on Mac OS 10.7. > > This application uses a wrapper method to look up other method names via > getattr and then call those methods. I have not previously had an

Re: getattr and method name

2011-10-02 Thread Terry Reedy
On 10/2/2011 6:02 PM, Kevin Walzer wrote: I'm seeing a very odd error in an application I'm developing using Python 2.7.2, on Mac OS 10.7. This application uses a wrapper method to look up other method names via getattr and then call those methods. I have not previously had an issue with this na

Re: TK + MVC

2011-10-02 Thread Alexander Kapps
On 03.10.2011 00:15, Emeka wrote: Greg, Do you have an example where the Controller is connected? What do you mean? In my example, the Controller *is* connected (to both the View and the Model.) -- http://mail.python.org/mailman/listinfo/python-list

Re: TK + MVC

2011-10-02 Thread Alexander Kapps
On 02.10.2011 04:40, Gregory Ewing wrote: Alexander Kapps wrote: But I think a simple (and quick 'n' dirty) Tk MVC example can look like this: The Controller doesn't seem to add any value in that example. You might as well connect the Model and Views directly to each other. Sure, in that s

Re: getattr and method name

2011-10-02 Thread Steven D'Aprano
On Sun, 02 Oct 2011 18:02:05 -0400, Kevin Walzer wrote: > I'm seeing a very odd error in an application I'm developing using > Python 2.7.2, on Mac OS 10.7. > > This application uses a wrapper method to look up other method names via > getattr and then call those methods. I have not previously ha

Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Rhodri James
On Sun, 02 Oct 2011 06:12:05 +0100, Andrew Berg wrote: I'm not sure the subject's wording is the best, but I'll try to explain. I have a main script that imports several modules and I need to be able to call methods from a class instance inside that main script from a module. Do you mean th

Re: getattr and method name

2011-10-02 Thread Kevin Walzer
Turns out the error was a typo in the actual method being called...*faceinhands* Sorry for the noise. -- Kevin Walzer Code by Kevin http://www.codebykevin.com -- http://mail.python.org/mailman/listinfo/python-list

Re: getattr and method name

2011-10-02 Thread Gary Herron
On 10/02/2011 05:24 PM, Kevin Walzer wrote: Turns out the error was a typo in the actual method being called...*faceinhands* Sorry for the noise. But this is a great example of why you should not use a naked except clause. As stated, your code will execute the except clause for *any* kin

Re: getattr and method name

2011-10-02 Thread Roy Smith
In article , Gary Herron wrote: > On 10/02/2011 05:24 PM, Kevin Walzer wrote: > > Turns out the error was a typo in the actual method being > > called...*faceinhands* > > > > Sorry for the noise. > > > > But this is a great example of why you should not use a naked except > clause. As state

Re: Change import order with *.pth files

2011-10-02 Thread rusi
On 10/02/2011 10:29 PM, Andrea Gavana wrote: > Hi All, >     my apologies if this is a dumb question, but I couldn't find a > solution  - possibly because I am not sure how to state my problem in > a short sentence. I think this (and such) are important questions and I too await answers. It seem

Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Andrew Berg
I found a way to do it, albeit a very hackish one. Since the class instance already catches exceptions from the modules it imports, I can make a custom exception (in a common area for both it and the submodules to import) for it to catch and have it call its own methods there based on information s

Re: timedelta is squicking me out

2011-10-02 Thread Chris Rebert
On Sun, Oct 2, 2011 at 7:27 PM, Phlip wrote: > has anyone invented a system like R*by's ActiveSupport's 5.years.ago, > 42.minutes.since ? > > (Yes, I'm aware the notation will be different!) If something involves Python and nontrivial chronology, then mxDateTime is the go-to library. And indeed,

Re: Python without a tty

2011-10-02 Thread Steven D'Aprano
On Fri, 30 Sep 2011 21:09:54 +0100, Nobody wrote: > On Thu, 29 Sep 2011 11:53:12 +0200, Alain Ketterlin wrote: > >>> I have a Python script which I would like to test without a tty >>> attached to the process. I could run it as a cron job, but is there an >>> easier way? [...] > I suspect that th

Re: TK + MVC

2011-10-02 Thread Greg Ewing
Emeka wrote: Greg, Do you have an example where the Controller is connected? No, in fact I've never really felt the need for anything called a Controller in the GUI stuff I've done. I just have Models and Views. Models hold the data, and Views display it and handle input. If you come across a

Re: Python without a tty

2011-10-02 Thread Hans Mulder
On 3/10/11 06:37:43, Steven D'Aprano wrote: On Fri, 30 Sep 2011 21:09:54 +0100, Nobody wrote: On Thu, 29 Sep 2011 11:53:12 +0200, Alain Ketterlin wrote: I have a Python script which I would like to test without a tty attached to the process. I could run it as a cron job, but is there an easie

Re: Python without a tty

2011-10-02 Thread Hegedüs , Ervin
hello, On Mon, Oct 03, 2011 at 04:37:43AM +, Steven D'Aprano wrote: > > I wanted to ensure that it would do the right thing when run without a tty, > such as from a cron job. If you fork() your process, then it will also loose the tty... import os import sys try: pid = os.fork()

Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-02 Thread Wong Wah Meng-R32813
Hello guys, I am migrating my application from python 1.5.2 to 2.7.1. I encountered an error when I run some commands (I put in debug statement however, not able to trace down to which line of code that cause it to generate a lot of messages in one second until my hard disk space is full. The e