As Jonathan says the ast module was introduced in Pyhton 2.6, you have 2.5.
On Friday, 19 July 2013 19:19:32 UTC-5, Auden RovelleQuartz wrote:
>
> From the Rackspace control panel, I can see I am running *Ubuntu 8.04.2
> LTS (hardy)* OS
>
> To start (or restart) web2py, I typically just reboot the VPS using a
> "reboot" command on a WinSCP application (a windows tool); occassionally I
> use a graphical reboot button on the Rackspace control panel to reboot the
> VPS.
>
> when I use a putty application and run the "which python" command, here is
> what I get
>
> {
>
> /usr/bin/python
>
> }
>
>
> when I use a putty application and run the "python --version" command,
> here is what I get
>
> {
>
> Python 2.5.2
>
> }
>
>
> when I use a putty application and run the "python" command, here is what
> I get
>
> {
>
> Python 2.5.2 (r252:60911, Oct 12 2012, 20:21:22)
> [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> }
>
> in the python shell, when I run the "import ast" command, I get the
> following
>
> {
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named ast
>
> }
>
>
> additional FYI: to install web2py on the rackspace VPS, I used putty to
> and as described in the web2py book, ran the
> {
>
> On Ubuntu:
>
> wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
> chmod +x setup-web2py-ubuntu.sh
> sudo ./setup-web2py-ubuntu.sh
>
> }
>
> just like there is a simple deployment recipe to install web2py from
> putty, is there a simple recipe to upgrade the python version to 2.7 and
> have it work with web2py?
>
>
> Thanks for your help
>
>
>
>
>
> On Friday, July 19, 2013 5:42:59 PM UTC-5, LightDot wrote:
>>
>> There is some misunderstanding here... what do you mean "bundled
>> python"?? Looking at the paths you posted earlier, I'd say you're on linux
>> and likely using Ubuntu. There is no python bundled with the source version
>> of web2py, you are using python that's installed on your OS.
>>
>> Please, let's start at the beginning:
>> - which OS are you using, post an exact version
>> - run 'which python' in shell and post the result
>> - run 'python --version' in shell and post the result
>> - type 'python' so that you get into python shell and try running 'import
>> ast', post the error if you get one (use exit() to get out of python shell
>> when you're done)
>> - please post the exact command you use to start web2py.
>>
>> Regards,
>> Ales
>>
>> On Friday, July 19, 2013 11:55:16 PM UTC+2, Auden RovelleQuartz wrote:
>>>
>>> Hello Jonathan
>>>
>>> do you mean 2.6 or later, or specifically 2.6?
>>>
>>> For your info if it would help any: I am running the python version
>>> that came bundled with the web2py version
>>> 2.5.1-stable+timestamp.2013.06.06.15.39.19<http://web2py.com/init/default/download>
>>> and
>>> the application is deployed on a rackspace VPS node
>>>
>>>
>>>
>>>
>>> On Friday, July 19, 2013 3:44:03 PM UTC-5, Jonathan Lundell wrote:
>>>>
>>>> On 19 Jul 2013, at 1:30 PM, Auden RovelleQuartz <[email protected]>
>>>> wrote:
>>>>
>>>> Hello Massimo,
>>>>
>>>> There is no file called "ast" at that location. Any ideas?
>>>>
>>>>
>>>> Check your Python version; I think you need to be running 2.6 for the
>>>> ast module.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Friday, July 19, 2013 11:33:45 AM UTC-5, Massimo Di Pierro wrote:
>>>>>
>>>>> Is it possible you have a file called ast under
>>>>> applications/<yourapp>/modules/ ?
>>>>>
>>>>> On Friday, 19 July 2013 08:09:40 UTC-5, Auden RovelleQuartz wrote:
>>>>>>
>>>>>> 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"
>>>>>> <https://omniavx.com/admin/edit/omniavx/controllers/developer.py>, line
>>>>>> 26, in <module>
>>>>>> File "/home/www-data/web2py/gluon/globals.py", line 194, in <lambda>
>>>>>> self._caller = lambda f: f()
>>>>>> File
>>>>>> "/home/www-data/web2py/applications/omniavx/controllers/developer.py"
>>>>>> <https://omniavx.com/admin/edit/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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.