Loading ...
Sorry, an error occurred while loading the content.

2598Re: [Cheetahtemplate-discuss] can't fill templates from strings

Expand Messages
  • Aaron Held
    Jul 6, 2004
      Can you post the code?

      I do this all the time:

      templateDef='''\
      Hello $rf'''
      rf = 'Aaron'
      t = Template(templateDef,[{'rf':rf}])

      Doug Wyatt wrote:

      > Hi,
      >
      > I'm using Cheetah 0.9.15 on Mac OS X 10.3.
      >
      > I can compile and fill templates from files just fine. I changed my
      > code so that I was creating a template from a string, however, and
      > this fails:
      >
      > Traceback (most recent call last):
      > ...
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Template.py", line 156, in __init__
      > self.compile(source, file)
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Template.py", line 245, in compile
      > compiler.compile()
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Compiler.py", line 1086, in compile
      > self.parse()
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Parser.py", line 1036, in parse
      > self.eatDirective()
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Parser.py", line 1150, in eatDirective
      > self.directiveEaters[directiveKey]()
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Parser.py", line 1470, in eatExtends
      > mod =
      > self._templateObj._importAsDummyModule('\n'.join(self._importStatements)
      > )
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Template.py", line 453, in
      > _importAsDummyModule
      > packageName = self._makeDummyPackageForDir(moduleDir)
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Template.py", line 477, in
      > _makeDummyPackageForDir
      > isPackageDir=1,forceReload=1)
      > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
      > python2.3/site-packages/Cheetah/Template.py", line 529, in
      > _importModuleFromDirectory
      > fp, pathname, stuff = imp.find_module(moduleName, [directory])
      > ImportError: No module named tmp
      >
      > In _importModuleFromDirectory:
      > fullModuleName= Cheetah.Temp._tmp
      > moduleName= tmp
      > directory= /
      >
      > So I guess Python is not finding the "__init__.py" written into /tmp.
      >
      > I wonder if it's because on Mac OS X, /tmp is a symlink to
      > /private/tmp ?
      >
      > Would appreciate any help.
      >
      > Thanks
      > Doug
      >
      >
      >
      > -------------------------------------------------------
      > This SF.Net email sponsored by Black Hat Briefings & Training.
      > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital
      > self defense, top technical experts, no vendor pitches, unmatched
      > networking opportunities. Visit www.blackhat.com
      > _______________________________________________
      > Cheetahtemplate-discuss mailing list
      > Cheetahtemplate-discuss@...
      > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss




      -------------------------------------------------------
      This SF.Net email sponsored by Black Hat Briefings & Training.
      Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
      digital self defense, top technical experts, no vendor pitches,
      unmatched networking opportunities. Visit www.blackhat.com
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Show all 4 messages in this topic