logo       

Re: cheetah test Failure: msg#00033

python.cheetah

Subject: Re: cheetah test Failure

On Tue, Oct 14, 2003 at 08:49:26AM -0600, Robert Uhl wrote:
> Mike Orr <mso@xxxxxx> writes:
> >
> > > I've cheetah 0.9.15 with Python 2.2.2 running on top of Red Hat's 9.0
> > > (patched up) Linux distro, and I get the following when I run cheetah
> > > test. Ccs would be nice, as I'm not subscribed to the list yet. Danke
> > > sch?n.
> > >
> > > ImportError: No module named SampleBaseClass
> >
> > Do you have write permission in the current directory?
>
> Yup; in my home directory. Here's the output again, as this time I
> ensured that I ran it from my home, rather than elsewhere:
>
> **********************************************************************
> ERROR Cheetah.Tests.SyntaxAndOutput.ExtendsDirective.test4 (#extends
> SampleBaseClass without #import)
...
> File "/usr/lib/python2.2/site-packages/Cheetah/Parser.py", line 1470, in
> eatExtends
> mod =
> self._templateObj._importAsDummyModule('\n'.join(self._importStatements))
> File "/usr/lib/python2.2/site-packages/Cheetah/Template.py", line 454, in
> _importAsDummyModule
> mod = self._impModFromDummyPackage(packageName, tmpFilename)
> File "/usr/lib/python2.2/site-packages/Cheetah/Template.py", line 496, in
> _impModFromDummyPackage
> moduleDir, forceReload=1)
> File "/usr/lib/python2.2/site-packages/Cheetah/Template.py", line 526, in
> _importModuleFromDirectory
> module = imp.load_module(fullModuleName, fp, pathname, stuff)
> File "/tmp/__CheetahTemp_2003101408470599889.py", line 13, in ?
> from SampleBaseClass import SampleBaseClass
> ImportError: No module named SampleBaseClass

I don't know then. There are various errors some people have in the
tests regarding temporary modules, but since they don't happen to me I
can't pin down what's happening. I'd be curious to see the content of
this temporary module it's executing
(/tmp/__CheetahTemp_2003101408470599889.py).

Does SampleBaseClass.py exist? I'd presume it would be in the current
directory, but you can verify by adding
print "Current directory is", os.getcwd()
print "SampleBaseClass.py exist? ", os.path.exists('SampleBaseClass.py')
in Cheetah/Tests/SyntaxAndOutput.py line 1949
(class ExtendsDirective, method setUp)
The output will appear somewhere above the traceback.

setUp creates this file before each ExtendsDirective test, and tearDown
deletes it.

Does sys.path include a '' entry, and/or does PYTHONPATH include a '.'
entry? I think Python does this automatically, but it's necessary to
make modules in the current directory importable.

Note that this is really one error, not three. All tests are run three
times, using the Unix, Windows and Mac end-of-line conventions in the
source templates. So the same error is being hit three times.

I'd ignore the problem. Whatever it is, it's unlikely to appear in
your templates. #extends can be touchy because it depends on a lot of
things being just right. But it's much easier to troubleshoot a
real-world scenario than the artificial environment the test uses as an
approximation. I'm tempted to just disable the test. I haven't been
keeping track of exactly which tests generate the file not found/module
not found errors, but if it turns out to always be this test, maybe the
test is more useless than it's worth.

--
-Mike Orr (aka. Sluggo), mso@xxxxxx (iron@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise