Cannot import tmpl_context

8 views
Skip to first unread message

apocalypznow

unread,
Jul 6, 2009, 1:51:05 AM7/6/09
to pylons-discuss
I am running python 2.5.2 on a debian based box (mint 5) and I used
the package manager to download pylons 0.9.6.1-1.

In python shell, when I type:
from pylons import tmpl_context
I get:
ImportError: cannot import name tmpl_context

How can I get this to work?


Also, what is wrong with python 2.6 and pylons? Deprecation warnings
and errors occur on the same import. I hesitate to show all the
errors here as I read somewhere that 2.6 is not supported in linux.
Is this true?

Piotr Ozarowski

unread,
Jul 6, 2009, 5:10:28 AM7/6/09
to pylons-...@googlegroups.com
[apocalypznow, 2009-07-06]

> I am running python 2.5.2 on a debian based box (mint 5) and I used
> the package manager to download pylons 0.9.6.1-1.

OT: please upgrade to 0.9.6.2-2 (from Debian stable) - serious bug was
fixed in 0.9.6.2
--
-=[ Piotr Ożarowski ]=-
-=[ http://www.ozarowski.pl ]=-

apocalypznow

unread,
Jul 6, 2009, 3:15:25 PM7/6/09
to pylons-discuss
version 9.6.2-2 is not available from Debian stable, but 9.6.2 is.
When I installed 9.6.2, it still results in the same problem.

The install procedure as documented on pylonshq.com gives 2
alternates:
a) using go-pylons.py with a virtual environment
b) using latest source of pylons

I don't want to use latest source, so option b) is out of the
question. However, I also don't want to use option a) because of the
virtual environment and the unneeded complexity of getting that to
work under a mod_wsgi setting with apache. I want to run pylons in
the default environment, as the installation will be a dedicated
server to the web applications. Can't we just have a normal download
and python installation, like just about every other python package
out there???

How do I go about getting version 9.7 and installing normally as in
any other python package?

apocalypznow

unread,
Jul 6, 2009, 3:27:28 PM7/6/09
to pylons-discuss
Never mind.... easy_install takes care of it: "easy_install pylons"

Sure wish they would have just said that on the install page of the
website.

Mike Orr

unread,
Jul 6, 2009, 10:43:50 PM7/6/09
to pylons-...@googlegroups.com
On Sun, Jul 5, 2009 at 10:51 PM, apocalypznow<apocal...@gmail.com> wrote:
>
> I am running python 2.5.2 on a debian based box (mint 5) and I used
> the package manager to download pylons 0.9.6.1-1.
>
> In python shell, when I type:
> from pylons import tmpl_context
> I get:
> ImportError: cannot import name tmpl_context

'tmpl_context' is new in Pylons 0.9.7. It was called 'c' in earlier
versions (and still is).

> Also, what is wrong with python 2.6 and pylons?  Deprecation warnings
> and errors occur on the same import.  I hesitate to show all the
> errors here as I read somewhere that 2.6 is not supported in linux.
> Is this true?

The Pylons package in Ubuntu 9.04 (and I guess the Debian equivalent)
is useless. The distros upgraded the default Python version but
forgot to check Pylons' compatibility with it. Pylons 0.9.7 is
compatible with Python 2.6, but it it was released too late to get
into the distros. This will be rectified in the next distro releases.

All virtualenvs have an 'activate_this.py' script, which I believe is
for cases like mod_wsgi that have problems with regular virtualenvs.

--
Mike Orr <slugg...@gmail.com>

Piotr Ozarowski

unread,
Jul 7, 2009, 5:52:13 AM7/7/09
to pylons-...@googlegroups.com
[Mike Orr, 2009-07-07]

> > Also, what is wrong with python 2.6 and pylons?  Deprecation warnings
> > and errors occur on the same import.  I hesitate to show all the
> > errors here as I read somewhere that 2.6 is not supported in linux.
> > Is this true?
>
> The Pylons package in Ubuntu 9.04 (and I guess the Debian equivalent)
> is useless. The distros upgraded the default Python version but
> forgot to check Pylons' compatibility with it. Pylons 0.9.7 is
> compatible with Python 2.6, but it it was released too late to get
> into the distros. This will be rectified in the next distro releases.

python-pylons is not in Ubuntu's main, so nobody cares about this
package there, they blindly merge various versions from Debian unstable
(while Debian can be in the middle of many transitions).

If Debian package is broken (or dependencies are outdated in unstable),
please send f*cks to piotr@d.o, though.

PS I'm working on backports of python-pylons 0.9.7 (and its dependencies,
including mod-wsgi) to Lenny - links will be available on pylons.debian.net

Graham Dumpleton

unread,
Jul 7, 2009, 6:52:14 AM7/7/09
to pylons-discuss


On Jul 7, 12:43 pm, Mike Orr <sluggos...@gmail.com> wrote:
> On Sun, Jul 5, 2009 at 10:51 PM, apocalypznow<apocalypz...@gmail.com> wrote:
>
> > I am running python 2.5.2 on a debian based box (mint 5) and I used
> > the package manager to download pylons 0.9.6.1-1.
>
> > In python shell, when I type:
> > from pylons import tmpl_context
> > I get:
> > ImportError: cannot import name tmpl_context
>
> 'tmpl_context' is new in Pylons 0.9.7.  It was called 'c' in earlier
> versions (and still is).
>
> > Also, what is wrong with python 2.6 and pylons?  Deprecation warnings
> > and errors occur on the same import.  I hesitate to show all the
> > errors here as I read somewhere that 2.6 is not supported in linux.
> > Is this true?
>
> The Pylons package in Ubuntu 9.04 (and I guess the Debian equivalent)
> is useless.  The distros upgraded the default Python version but
> forgot to check Pylons' compatibility with it.  Pylons 0.9.7 is
> compatible with Python 2.6, but it it was released too late to get
> into the distros.  This will be rectified in the next distro releases.
>
> All virtualenvs have an 'activate_this.py' script, which I believe is
> for cases likemod_wsgithat have problems with regular virtualenvs.

Actually, it is recommended that you don't use activate_this.py in
mod_wsgi and not necessarily a good idea in mod_python either.

This is documented in:

http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

Using virtual environments with Apache/mod_wsgi isn't that hard and is
also explained in that document, so not sure what the issue was.

Graham
Reply all
Reply to author
Forward
0 new messages