Re: [web2py] ast module

2013-07-21 Thread Jonathan Lundell
On 21 Jul 2013, at 5:07 AM, LightDot  wrote:
> I suggest looking into RHEL Software Collections, which were created to solve 
> this exact problem. They allow you to install newer versions of software in 
> rpm safely into /opt and switch between new and old releases. This allows 
> your RHEL system applications to continue to run with the old version, while 
> new apps can work with the new version.

Thanks, I'll check that out.

The problem I was running into, IIRC, had to do with coordinating a new Python 
with mod_wsgi and web2py's virtualenv. I'll re-read the wsgi instructions for 
that, I guess.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] ast module

2013-07-21 Thread LightDot
On Saturday, July 20, 2013 5:10:38 PM UTC+2, Jonathan Lundell wrote:

> I was bitten by this (other features, not ast) just yesterday. My local 
> environment (OS X) has 2.7; my production environment (RHEL6) had 2.6. 
> Turns out that 2.6 does not support collections.Counter (no surprise there, 
> really). More surprising, it doesn't support the flags argument to 
> re.sub(). Huh? Easy to work around, but still...
>
> When I set up the servers, I started by installing 2.7.latest, but ran 
> into some conflicts that I don't recall the details of right now, and 
> reverted to the system-supplied 2.6. One of these days I'll have to set up 
> a fresh server and figure out what it takes to run 2.7.
>

RHEL and derivatives (CentOS, Scientific Linux) are somewhat touchy when it 
comes to the main OS python version. Python is used for yum and various 
other pieces of key OS components, so upgrading python can be problematic. 
Upgrading to vanilla python also negates the value of long term RHEL 
support (python 2.6.6 on RHEL 6 will be supported until 2023!).

I suggest looking into RHEL Software Collections, which were created to 
solve this exact problem. They allow you to install newer versions of 
software in rpm safely into */opt* and switch between new and old releases. 
This allows your RHEL system applications to continue to run with the old 
version, while new apps can work with the new version.

http://developerblog.redhat.com/2013/06/05/red-hat-software-collections-1-0-beta-now-available/
https://fedorahosted.org/SoftwareCollections/

Software Collections have 3 years of support - this only means that for 3 
years there is a complete ABI/API compatibility guarantee for ie. python 
2.7.3 and 3.3.0, then versions might change.

They seem to have had Django in mind when creating python collections, 
which might be also relevant for web2py. There are further articles about 
this, like:
http://developerblog.redhat.com/2013/02/14/setting-up-django-and-python-2-7-on-red-hat-enterprise-6-the-easy-way/

Since a large part of my work is system administration (mostly RHEL), I 
really welcomed Software Collections... Makes my life easier and my custom 
yum repos much smaller... :)

Regards,
Ales

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] ast module

2013-07-20 Thread Jonathan Lundell
On 20 Jul 2013, at 12:02 AM, Massimo Di Pierro  
wrote:
> As Jonathan says the ast module was introduced in Pyhton 2.6, you have 2.5.

I was bitten by this (other features, not ast) just yesterday. My local 
environment (OS X) has 2.7; my production environment (RHEL6) had 2.6. Turns 
out that 2.6 does not support collections.Counter (no surprise there, really). 
More surprising, it doesn't support the flags argument to re.sub(). Huh? Easy 
to work around, but still...

When I set up the servers, I started by installing 2.7.latest, but ran into 
some conflicts that I don't recall the details of right now, and reverted to 
the system-supplied 2.6. One of these days I'll have to set up a fresh server 
and figure out what it takes to run 2.7.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] ast module

2013-07-19 Thread Auden RovelleQuartz
on regular python - for example on a www.compilr.com account, I am able to 
create and successfully execute this trivial program (in the {} brackets:

{

#!/usr/bin/python  

import ast
l = ast.literal_eval('["a","31","c"]')
l = [i.strip() for i in l]
print l[1]

}


but when I try to use the ast module within the web2py framework as in this 
controller function:

{

def index():
import ast
rec = db(db.audentest.id > 0).select()
item = rec[0]
l = ast.literal_eval(item)
l = [i.strip() for i in l]
quantity1 = l
link = A("Test View", _href=URL(r=request,f="testview"))
return dict(link = link, quantity1 = quantity1)
}

I get the following error trace:

{

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File "/home/www-data/web2py/applications/omniavx/controllers/developer.py" 
, line 26, in 

  File "/home/www-data/web2py/gluon/globals.py", line 194, in 
self._caller = lambda f: f()
  File "/home/www-data/web2py/applications/omniavx/controllers/developer.py" 
, line 2, in 
index
import ast
  File "/home/www-data/web2py/gluon/custom_import.py", line 81, in 
custom_importer
raise ImportError, 'Cannot import module %s' % str(e)


}


Does anyone know how to import the ast module so that it works in the 
web2py framework?

Thanks

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.