unittest exits

2008-11-13 Thread Alan Baljeu
When I call unittest.main(), it invokes sys.exit().  I would like to run tests 
without exiting.  How can I?


 Alan Baljeu


  __
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! 
Canada Messenger at http://ca.beta.messenger.yahoo.com/
--
http://mail.python.org/mailman/listinfo/python-list


Installing packages

2008-11-13 Thread Alan Baljeu
I'm new to Python, and just downloaded Py2.6.  I also want to use Nose.  So I 
downloaded the latest sources, but it's not at all clear what's the best way to 
put this stuff into the Python package system.  Nose supports easy_install, 
easy_install doesn't have an installer for Windows and Py2.6, so I think I 
can't use that.  (It only does 2.5 and earlier.  (Should I go to Py2.5?  Is 
there more support out there for that?)).  


Alan Baljeu


  __
Ask a question on any topic and get answers from real people. Go to Yahoo! 
Answers and share what you know at http://ca.answers.yahoo.com
--
http://mail.python.org/mailman/listinfo/python-list


embedding python

2008-11-13 Thread Alan Baljeu
Thanks, I have 2.5 now and it works great with Nose.  Now for my next project, 
I want to embed Python and Nose in a C++ program.  I know this means using the 
python25.dll, and I know how to setup the calls.  
I think though I will not be installing Python on target systems, so I don't 
want to rely on sys.path including "site-install".  I would have a directory 
with appropriate python files, a subdir for nose, and keep those relative to 
the application dir.

For the Python interpreter, two questions:
1. What is the best way to manage the import paths?
2. How can I invoke an interactive console for this embedded python?  I'd like 
to play with things while my app is running.





- Original Message 
From: Diez B. Roggisch <[EMAIL PROTECTED]>
To: python-list@python.org
Sent: Thursday, November 13, 2008 2:41:03 PM
Subject: Re: Installing packages

Alan Baljeu schrieb:
> I'm new to Python, and just downloaded Py2.6.  I also want to use Nose.  So I 
> downloaded the latest sources, but it's not at all clear what's the best way 
> to put this stuff into the Python package system.  Nose supports 
> easy_install, easy_install doesn't have an installer for Windows and Py2.6, 
> so I think I can't use that.  (It only does 2.5 and earlier.  (Should I go to 
> Py2.5?  Is there more support out there for that?)).  

2.6 is most probably a bit to fresh.

I'd go for 2.5.


  __
Ask a question on any topic and get answers from real people. Go to Yahoo! 
Answers and share what you know at http://ca.answers.yahoo.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python IF THEN chain equivalence

2008-11-13 Thread Alan Baljeu
I think you should rethink your post. The first case you posted makes no sense 
in any language I know.  Also, a whole lot of nested IF's is a bad idea in any 
language.  In Python, you will end up with code indented 40+ characters if you 
keep going.



- Original Message 
From: jzakiya <[EMAIL PROTECTED]>
To: python-list@python.org
Sent: Thursday, November 13, 2008 5:06:53 PM
Subject: Python IF THEN chain equivalence

I'm translating a program in Python that has this IF Then chain


IF  x1 < limit:   --- do a ---
IF  x2 < limit:  --- do b ---
IF x3 < limit:  --- do c ---
   .-
--
IF  x10 < limt: --- do j ---
THEN
 THEN
  -
  THEN
 THEN
THEN

In other words, as long as'xi' is less than 'limit' keep going
down the chain, and when 'xi' isn't less than 'limit' jump to end of
chain a continue.

Is this the equivalence in Python?

IF  x1 < limit:
--- do a  ---
elif x2 < limit:
--- do b ---


elif x10 < limit:
   --- do j ---


--
http://mail.python.org/mailman/listinfo/python-list



  __
Ask a question on any topic and get answers from real people. Go to Yahoo! 
Answers and share what you know at http://ca.answers.yahoo.com
--
http://mail.python.org/mailman/listinfo/python-list


automatic reload

2008-11-14 Thread Alan Baljeu
I need a solution for automatically reloading files I edited.  This is in a 
unit testing/fixing context, so there shouldn't be much problem with leftover 
data.  I just need to be able to call a reload_changed() method of some sort 
before rerunning tests.  Stopping and restarting the python interpreter (it's 
embedded) might be an option if (a) that's feasible within a process and (b) 
it's quick.

 Alan Baljeu
http://www.collaborative-systems.org
Intelligent software that works _with_ you.



  __
Get a sneak peak at messages with a handy reading pane with All new Yahoo! 
Mail: http://ca.promos.yahoo.com/newmail/overview2/
--
http://mail.python.org/mailman/listinfo/python-list


Fw: automatic reload

2008-11-14 Thread Alan Baljeu


 Alan Baljeu
http://www.collaborative-systems.org
Intelligent software that works _with_ you.



- Forwarded Message 
From: Alan Baljeu <[EMAIL PROTECTED]>
To: Mike Driscoll <[EMAIL PROTECTED]>
Sent: Friday, November 14, 2008 2:06:26 PM
Subject: Re: automatic reload

I thought I was reading something specific was made for unittest, although I 
can't find it now.  TurboGears I don't know much about.  I'm concerned its 
reload is specialized for a certain type of file (page generators?) and might 
not be suitable in general.


The other option I was suggessting PyInitialize and Py_Finalize.  Finalize 
comes with a scary list of issues, which basically say things may fail and 
memory may leak.  I notice also Py_NewInterpreter/Py_EndInterpreter does about 
the same thing for me.  Maybe that's the way to go.  But these caveats scare me:



Also note that the use of this functionality is incompatible with extension
modules such as PyObjC and ctypes that use the PyGILState_* APIs (and
this is inherent in the way the PyGILState_* functions work).  Simple
things may work, but confusing behavior will always be near.I'm not sure what 
these are, but they sound like what I would use in embedding the interpreter.  
But then again, this is a C function designed for embedding.  How could this be 
a problem?




Alan Baljeu




- Original Message 
From: Mike Driscoll <[EMAIL PROTECTED]>
To: python-list@python.org
Sent: Friday, November 14, 2008 12:08:06 PM
Subject: Re: automatic reload

On Nov 14, 11:04 am, Alan Baljeu <[EMAIL PROTECTED]> wrote:
> I need a solution for automatically reloading files I edited.  This is in a 
> unit testing/fixing context, so there shouldn't be much problem with leftover 
> data.  I just need to be able to call a reload_changed() method of some sort 
> before rerunning tests.  Stopping and restarting the python interpreter (it's 
> embedded) might be an option if (a) that's feasible within a process and (b) 
> it's quick.
>
>  Alan Baljeuhttp://www.collaborative-systems.org
> Intelligent software that works _with_ you.
>

There's the "reload" builtin that you could use. In your method, just
call reload on the modules you need reloaded. TurboGears somehow
watches files for changes, so you might want to check out their source
to see how it works. I'm sure it's something similar.

Mike
--
http://mail.python.org/mailman/listinfo/python-list



  __
Get a sneak peak at messages with a handy reading pane with All new Yahoo! 
Mail: http://ca.promos.yahoo.com/newmail/overview2/



  __
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/
--
http://mail.python.org/mailman/listinfo/python-list