Re: problem with include directive on cheetah 2.4.0

[email protected] Fri, 13 Nov 2009 14:15:00 -0800
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
On Fri, 13 Nov 2009, Uhanov, Kirill wrote:

> Hi, All
> Could you help me with my issue?
> Some of my templates use include directive.
> But I have NameError error then I run generated py file.
> 
> For example, I have tmpl and txt files (they are located in c:\__1 dir)
> 
> temp.tmpl
>             #include "temp.txt"
> temp.txt
>             Hello
> 
> Call compile cmdline command
>       python C:\python\Scripts\cheetah-compile temp.tmpl
> 
> Run generated py script:
> python temp.py
> 
> Traceback (most recent call last):
>   File "temp.py", line 124, in <module>
>     CmdLineIface(templateObj=temp()).run()
>   File "C:\python\lib\site-packages\Cheetah\TemplateCmdLineIface.py", line 44, in run
>     print self._template
>   File "C:\python\lib\site-packages\Cheetah\Template.py", line 997, in __str__
>     rc = getattr(self, mainMethName)()
>   File "temp.py", line 82, in respond
>     self._handleCheetahInclude("temp.txt", trans=trans, includeFrom="file", raw=False)
>   File "C:\python\lib\site-packages\Cheetah\Template.py", line 1582, in _handleCheetahInclude
>     _globalSetVars=self._CHEETAH__globalSetVars)
>   File "__1_temp_txt.py", line 55, in __init__
> NameError: global name '_1_temp_txt__1_temp_txt' is not defined
> 
> 
> If I move temp.py to c:\1 directory all works fine
> 
> What did I do wrong? Is this known problem?

At first glance, nothing here looks wrong (at least in your usage of #include),
that said I won't have a chance to take a look at this until tomorrow morning.

Do you have access to a Mac or Windows machine to try this there? I'd just like
to rule out that this is not a Cheetah/Windows issue.

Cheers,
-R. Tyler Ballance
--------------------------------------
 GitHub: http://github.com/rtyler
Twitter: http://twitter.com/agentdero
   Blog: http://unethicalblogger.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)

iEYEARECAAYFAkr92mMACgkQFCbH3D9R4W9Z7ACdFCm4v5UNe5YrlT9gZepIzAuk
7fAAnAxWlwQEgb/sJIJtXoubu5DyY+vY
=qZHL
-----END PGP SIGNATURE-----