WebFaction
Community site: login faq

I'm trying to use Jinja2 with CherryPy, and I can't get it groove. I've installed Jinja2 with easy_install, and I can import it from the python shell, but when I try to import through CherryPy as it's being served, it raises an import error. What's going on?

asked 20 May '11, 01:35

Abe Stanway
112
accept rate: 0%


The default Python on the system is python2.4, but it's possible that your application is using a different python version. We have easy_install-2.5, easy_install-2.6, etc available to install packages for different versions of Python. Can you confirm that the "python" you're invoking from the command line and importing Jinja2 with is the same "python" version that the CherryPy instance is running on?

permanent link

answered 20 May '11, 01:50

ryans ♦♦
5.0k93360
accept rate: 43%

Hmm. Python from the terminal shows version 2.4.3. On the control panel, it says that the application uses Python 3.1. I just now tried running easy_install-3.1 tweepy, and it said "command not found"

(20 May '11, 02:03) Abe Stanway

alright, so since the default python is 2.4, i've just gone ahead and made a cherrypy app that uses 2.4. it's all peaches now, thanks

(20 May '11, 02:20) Abe Stanway

easy_install is actually not a very elegant package-installation system. It's much "cleaner" to just create the ~/lib/python3.1/ directory and place your package in there, or to download the package and use its "setup.py" install script (with python3.1 setup.py install). So, it's being phased out for python 3 on our systems.

Normally, you should just run a cherrypy application on Python 2.x unless you plan to use and want the Python3 syntax, features, and environment. Our Control Panel one-click installers include python2.x as installation options.

(20 May '11, 02:22) ryans ♦♦

foo

permanent link

answered 11 Jan '14, 15:23

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×32
×1

question asked: 20 May '11, 01:35

question was seen: 4,732 times

last updated: 11 Jan '14, 15:23

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM