Re: Suggestion for improved ImportError message

2008-08-23 Thread Fredrik Lundh
Lie wrote: I have code that uses numpy if available, otherwise uses slower normal Python code. Inside the doctests I'd like to test both situations... Why? Is there a difference in result if you have used numpy and python code? If that is, I smell a bad code. What numpy and python code version

Re: Suggestion for improved ImportError message

2008-08-23 Thread Lie
On Aug 15, 7:42 pm, [EMAIL PROTECTED] wrote: > Lie: > > >I'm not sure there are any reason to test for failed import in doctest)< > > I have code that uses numpy if available, otherwise uses slower normal > Python code. Inside the doctests I'd like to test both situations... Why? Is there a differ

Re: Suggestion for improved ImportError message

2008-08-15 Thread Benjamin
On Aug 13, 3:55 pm, Kent Tenney <[EMAIL PROTECTED]> wrote: > Howdy, > > I was just bit by > > from image import annotate > > ImportError: cannot import name annotate > > I found the problem via > > import image > print image.__file__ > > which made it clear that the wrong image module had been foun

Re: Suggestion for improved ImportError message

2008-08-15 Thread bearophileHUGS
Lie: >I'm not sure there are any reason to test for failed import in doctest)< I have code that uses numpy if available, otherwise uses slower normal Python code. Inside the doctests I'd like to test both situations... Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestion for improved ImportError message

2008-08-15 Thread Lie
On Aug 14, 5:10 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Thu, 14 Aug 2008 01:35:44 + (UTC), Kent Tenney wrote: > >> > Then go for it  You can prepare a patch and ask on python-dev > >> > if the developers are interested. > > > hehe, I'll get a C level patch accepted right after I > >

Re: Suggestion for improved ImportError message

2008-08-14 Thread Wojtek Walczak
On Thu, 14 Aug 2008 01:35:44 + (UTC), Kent Tenney wrote: >> > Then go for it You can prepare a patch and ask on python-dev >> > if the developers are interested. > > hehe, I'll get a C level patch accepted right after I > out-swim Mike Phelps. It's really not that hard. The only hard thing (

Re: Suggestion for improved ImportError message

2008-08-13 Thread Kent Tenney
> > Then go for it You can prepare a patch and ask on python-dev > > if the developers are interested. hehe, I'll get a C level patch accepted right after I out-swim Mike Phelps. > > > > I was never hacking the import things on C level before, > > but a hint: you have to modify import_from func

Re: Suggestion for improved ImportError message

2008-08-13 Thread Wojtek Walczak
Dnia Wed, 13 Aug 2008 22:15:48 + (UTC), Wojtek Walczak napisa�(a): > Then go for it :-) You can prepare a patch and ask on python-dev > if the developers are interested. > > I was never hacking the import things on C level before, > but a hint: you have to modify import_from function from > Py

Re: Suggestion for improved ImportError message

2008-08-13 Thread Fredrik Lundh
Kent Tenney wrote: I was just bit by from image import annotate ImportError: cannot import name annotate I found the problem via import image print image.__file__ which made it clear that the wrong image module had been found. that's what "python -v" is all about, of course. -- http:

Re: Suggestion for improved ImportError message

2008-08-13 Thread Wojtek Walczak
Dnia Wed, 13 Aug 2008 20:55:38 + (UTC), Kent Tenney napisa�(a): > from image import annotate > > ImportError: cannot import name annotate > > I found the problem via > > import image > print image.__file__ > > which made it clear that the wrong image module had been found. > > It would be nic

Suggestion for improved ImportError message

2008-08-13 Thread Kent Tenney
Howdy, I was just bit by from image import annotate ImportError: cannot import name annotate I found the problem via import image print image.__file__ which made it clear that the wrong image module had been found. It would be nice if ImportError announced this up front. cannot import name