Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> On Sun, 09 Dec 2007 00:25:53 +, Jeremy C B Nicoll wrote:
>
> > > for app_name in settings.INSTALLED_APPS:
> > > try:
> > > __import__(app_name + '.management', {}, {}, [''])
> > > except ImportError, exc:
> >
On Sun, 09 Dec 2007 00:25:53 +, Jeremy C B Nicoll wrote:
> > for app_name in settings.INSTALLED_APPS:
> > try:
> > __import__(app_name + '.management', {}, {}, [''])
> > except ImportError, exc:
> > if exc.args[0]!='No module named manageme
Thomas Guettler <[EMAIL PROTECTED]> wrote:
> If you look at this code, you see there are two kind of ImportErrors:
>
> 1. app_name has no attribute or file managment.py: That's OK.
> 2. managment.py exists, but raises an ImportError: That's not OK: reraise
>
> # Import the 'management' m
On 1 dic, 02:41, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
> On Dec 1, 12:24 am, Thomas Guettler <[EMAIL PROTECTED]> wrote:
>
> > Sorry, but this does not work. If there is an ImportError
> > during importing the existing module, it won't get inserted
> > into sys.modules. I just tried it with a
Graham Dumpleton schrieb:
> What example did you use to test it? What version of Python are you
> using?
Yes, this changed. Python 2.3 includes the half imported module. Python 2.4
does not.
But the traceback of the exception contains the needed information:
Here are the two example files:
# fo
On Dec 1, 12:24 am, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> Sorry, but this does not work. If there is an ImportError
> during importing the existing module, it won't get inserted
> into sys.modules. I just tried it with a small example.
>
> An other solution would be to inspect the traceback.
Sorry, but this does not work. If there is an ImportError
during importing the existing module, it won't get inserted
into sys.modules. I just tried it with a small example.
An other solution would be to inspect the traceback. If the
app_name+'.management' is in it, it exists.
Graham Dumpleton sc
Thomas Guettler wrote:
> If you look at this code, you see there are two kind of ImportErrors:
>
> 1. app_name has no attribute or file managment.py: That's OK.
> 2. managment.py exists, but raises an ImportError: That's not OK: reraise
>
> # Import the 'management' module within each in
On Nov 28, 12:35 am, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> If you look at this code, you see there are two kind of ImportErrors:
>
> 1. app_name has no attribute or file managment.py: That's OK.
> 2. managment.py exists, but raises an ImportError: That's not OK: reraise
>
> # Import
On Nov 27, 3:50 pm, [EMAIL PROTECTED] (Aahz) wrote:
> In article <[EMAIL PROTECTED]>,
>
> <[EMAIL PROTECTED]> wrote:
>
> ># untested
> >args = exc.args[0]
> >if args.find('management') != -1:
> >raise
>
> YM
>
> if 'management' in args:
> raise
>
> HTH, HAND ;-)
> --
> Aahz ([EMAIL PROTEC
In article <[EMAIL PROTECTED]>,
<[EMAIL PROTECTED]> wrote:
>
># untested
>args = exc.args[0]
>if args.find('management') != -1:
>raise
YM
if 'management' in args:
raise
HTH, HAND ;-)
--
Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/
"Typing is cheap. Thin
On Nov 27, 7:35 am, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> If you look at this code, you see there are two kind of ImportErrors:
>
> 1. app_name has no attribute or file managment.py: That's OK.
> 2. managment.py exists, but raises an ImportError: That's not OK: reraise
>
> # Import t
If you look at this code, you see there are two kind of ImportErrors:
1. app_name has no attribute or file managment.py: That's OK.
2. managment.py exists, but raises an ImportError: That's not OK: reraise
# Import the 'management' module within each installed app, to register
# d
13 matches
Mail list logo