I found that the problem is on geopy in pythonanywhere not in virtual field.

If I change:

import geopy.distance

in

from geopy.distance import vincenty

in pythonanywhere:

ImportError: cannot import name vincenty

In local installation it works.


Thanks for hints!
Fabio




Il giorno domenica 7 gennaio 2018 15:21:42 UTC+1, Fabio Ceccarani ha 
scritto:
>
> Hi all, 
> I have 'distance' virtual field definition in controller:
>
> location = (session.lat, session.lon)
> db.courses.distance = Field.Virtual('distance', lambda row: 
> int(geopy.distance.vincenty(location,(row.courses.lat,row.courses.lng)).km))
>
> and visualization on view:
>
> <span>
> {{=course.distance}}
> </span
>
> It works perfectly on local application (ubuntu, python 2.7), but not in 
> Pythonanywhere. 
> It return this error (these are relevant row):
>  
> <type 'exceptions.AttributeError'>
> ...
>
> Code listing
> ...
> response.write(course.distance)
> ...
>
> Function argument list
> (self=<Row {'subtitle': 'Come avvicinarsi, scoprire e 
> ...eimg02.a4df5906751f9f78.71676973312e706e67.png'}>, k='distance')
>
>
> What could be the determinant difference betweeb my environment and 
> hosting? Python version is the same.
> Thanks!
> Fabio
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to