On Jul 15, 2008, at 10:17 PM, Ian Bicking wrote:

> Patrick Lewis wrote:
>> Does Tempita support imports? In my template
>> {{py:import datetime}}
>> throws an exception:
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in <module>
>>    File "build/bdist.macosx-10.3-i386/egg/tempita/__init__.py",  
>> line  136, in substitute
>>    File "build/bdist.macosx-10.3-i386/egg/tempita/__init__.py",  
>> line  142, in _interpret
>>    File "build/bdist.macosx-10.3-i386/egg/tempita/__init__.py",  
>> line  151, in _interpret_codes
>>    File "build/bdist.macosx-10.3-i386/egg/tempita/__init__.py",  
>> line  157, in _interpret_code
>>    File "build/bdist.macosx-10.3-i386/egg/tempita/__init__.py",  
>> line  237, in _exec
>>    File "<string>", line 1, in <module>
>> SystemError: Parent module 'silverplate' not loaded at line 29  
>> column  3 in file silverplate.py_tmpl
>
> It should support that.  I've never seen an error like that before.  
> Unless this might be something related to absolute/relative  
> imports?  I have tested primarily on Python 2.4, where that  
> wouldn't come up.
>

Ok, a little more info.  Not doing anything too weird here. Here is  
my template (named tst.py_tmpl):

http://paste.turbogears.org/paste/3230

python 2.4 works as expected.

Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from tempita import Template
 >>> Template.from_filename('tst.py_tmpl').substitute()
"\n# Please do not change (used for template idenfitfication and  
upgrades)\n_template_name      =  
'tg.ext.silverplate.config'\n_template_version   =  
2008-07-16T21:03:42.497208"

A big WTF with my main python 2.5 install.  PIL?

Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from tempita import Template
 >>> Template.from_filename('tst.py_tmpl').substitute()
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/PIL/__init__.py", line 136, in substitute

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/PIL/__init__.py", line 142, in _interpret

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/PIL/__init__.py", line 151, in _interpret_codes

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/PIL/__init__.py", line 157, in _interpret_code

   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/PIL/__init__.py", line 237, in _exec

   File "<string>", line 1, in <module>
SystemError: Parent module 'tst' not loaded at line 3 column 3 in  
file tst.py_tmpl


A fresh virtualenv --no-site-packages with only tempita installed:


Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from tempita import Template
 >>> Template.from_filename('tst.py_tmpl').substitute()
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/Users/plewis/Programming/TurboGears/tempita_env/lib/ 
python2.5/site-packages/Tempita-0.2-py2.5.egg/tempita/__init__.py",  
line 136, in substitute
   File "/Users/plewis/Programming/TurboGears/tempita_env/lib/ 
python2.5/site-packages/Tempita-0.2-py2.5.egg/tempita/__init__.py",  
line 142, in _interpret
   File "/Users/plewis/Programming/TurboGears/tempita_env/lib/ 
python2.5/site-packages/Tempita-0.2-py2.5.egg/tempita/__init__.py",  
line 151, in _interpret_codes
   File "/Users/plewis/Programming/TurboGears/tempita_env/lib/ 
python2.5/site-packages/Tempita-0.2-py2.5.egg/tempita/__init__.py",  
line 157, in _interpret_code
   File "/Users/plewis/Programming/TurboGears/tempita_env/lib/ 
python2.5/site-packages/Tempita-0.2-py2.5.egg/tempita/__init__.py",  
line 237, in _exec
   File "<string>", line 1, in <module>
SystemError: Parent module 'tst' not loaded at line 3 column 3 in  
file tst.py_tmpl



_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users

Reply via email to