librelist archives

« back to archive

Error after upgrade

Error after upgrade

From:
Alex
Date:
2010-07-29 @ 11:57
Hi all.

After an upgrade to version 0.6 (pip install --upgrade flask
) I have an error running my flask applications, even the "hello
world" example from the tutorial. Here's the traceback:

alex@haiku:~/code/scripts/hello$ python hello.py
Traceback (most recent call last):
  File "hello.py", line 2, in <module>
    app = Flask(__name__)
  File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line
286, in __init__
    self.jinja_env = self.create_jinja_environment()
  File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line
320, in create_jinja_environment
    return Environment(loader=_DispatchingJinjaLoader(self), **options)
  File "/usr/lib/pymodules/python2.6/jinja2/environment.py", line 271,
in __init__
    self.extensions = load_extensions(self, extensions)
  File "/usr/lib/pymodules/python2.6/jinja2/environment.py", line 74,
in load_extensions
    extension = import_string(extension)
  File "/usr/lib/pymodules/python2.6/jinja2/utils.py", line 200, in
import_string
    return getattr(__import__(module, None, None, [obj]), obj)
AttributeError: 'module' object has no attribute 'autoescape'

I see that there is some problem with Jinja2 but I cannot understand
why. Here is the source code

alex@haiku:~/code/scripts/hello$ cat hello.py
from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()

Any ideas?

Alex

Re: [flask] Error after upgrade

From:
Stephane Wirtel
Date:
2010-07-29 @ 12:04
Could you check if you have the last version of Jinja2 ?

Thank you
On 07/29/2010 01:57 PM, Alex wrote:
> Hi all.
> 
> After an upgrade to version 0.6 (pip install --upgrade flask
> ) I have an error running my flask applications, even the "hello
> world" example from the tutorial. Here's the traceback:
> 
> alex@haiku:~/code/scripts/hello$ python hello.py
> Traceback (most recent call last):
>   File "hello.py", line 2, in <module>
>     app = Flask(__name__)
>   File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line
> 286, in __init__
>     self.jinja_env = self.create_jinja_environment()
>   File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line
> 320, in create_jinja_environment
>     return Environment(loader=_DispatchingJinjaLoader(self), **options)
>   File "/usr/lib/pymodules/python2.6/jinja2/environment.py", line 271,
> in __init__
>     self.extensions = load_extensions(self, extensions)
>   File "/usr/lib/pymodules/python2.6/jinja2/environment.py", line 74,
> in load_extensions
>     extension = import_string(extension)
>   File "/usr/lib/pymodules/python2.6/jinja2/utils.py", line 200, in
> import_string
>     return getattr(__import__(module, None, None, [obj]), obj)
> AttributeError: 'module' object has no attribute 'autoescape'
> 
> I see that there is some problem with Jinja2 but I cannot understand
> why. Here is the source code
> 
> alex@haiku:~/code/scripts/hello$ cat hello.py
> from flask import Flask
> app = Flask(__name__)
> 
> @app.route("/")
> def hello():
>     return "Hello World!"
> 
> if __name__ == "__main__":
>     app.run()
> 
> Any ideas?
> 
> Alex

Re: [flask] Error after upgrade

From:
Alex
Date:
2010-07-29 @ 13:42
Thanks Stephane you pointed me in the right direction.

For some reason my OS package manager installed an old version of Jinja2.
Removing the package and upgrading thje library via

pip install --upgrade jinja2

solved the problem.

Thanks a lot

Alex

On Thu, Jul 29, 2010 at 2:04 PM, Stephane Wirtel <stephane@wirtel.be> wrote:
> Could you check if you have the last version of Jinja2 ?
>
> Thank you
> On 07/29/2010 01:57 PM, Alex wrote:
>> Hi all.
>>
>> After an upgrade to version 0.6 (pip install --upgrade flask
>> ) I have an error running my flask applications, even the "hello
>> world" example from the tutorial. Here's the traceback:
>>
>> alex@haiku:~/code/scripts/hello$ python hello.py
>> Traceback (most recent call last):
>>   File "hello.py", line 2, in <module>
>>     app = Flask(__name__)
>>   File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line
>> 286, in __init__
>>     self.jinja_env = self.create_jinja_environment()
>>   File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line
>> 320, in create_jinja_environment
>>     return Environment(loader=_DispatchingJinjaLoader(self), **options)
>>   File "/usr/lib/pymodules/python2.6/jinja2/environment.py", line 271,
>> in __init__
>>     self.extensions = load_extensions(self, extensions)
>>   File "/usr/lib/pymodules/python2.6/jinja2/environment.py", line 74,
>> in load_extensions
>>     extension = import_string(extension)
>>   File "/usr/lib/pymodules/python2.6/jinja2/utils.py", line 200, in
>> import_string
>>     return getattr(__import__(module, None, None, [obj]), obj)
>> AttributeError: 'module' object has no attribute 'autoescape'
>>
>> I see that there is some problem with Jinja2 but I cannot understand
>> why. Here is the source code
>>
>> alex@haiku:~/code/scripts/hello$ cat hello.py
>> from flask import Flask
>> app = Flask(__name__)
>>
>> @app.route("/")
>> def hello():
>>     return "Hello World!"
>>
>> if __name__ == "__main__":
>>     app.run()
>>
>> Any ideas?
>>
>> Alex
>
>