it's not a web2py issue but it seems something with the Shopify lib and 
that bug that isn't going very well.... as of "web2py starts with something 
else" you need to check your setup.... web2py can't choose what python 
version to run at runtime....

On Sunday, October 12, 2014 7:39:16 PM UTC+2, Luciano Laporta Podazza wrote:
>
> It seems to.
>
> I've tried using pyenv to switch to Python 2.7.5 (the one it works), 
> declared it as global and verified that works running 'python', reinstalled 
> web2py 2.9.11 on server but web2py it still uses Python *2.7.6*.
>
> On the other hand I've tried to apply the patch with no luck (actually I'm 
> learning how to do it :P)
>
> Any suggestions?. Thanks!
>
> On Sun, Oct 12, 2014 at 10:07 AM, Niphlod <[email protected] <javascript:>> 
> wrote:
>
>> uhm, could be something related to 
>>
>> http://bugs.python.org/issue21720
>>
>>
>>
>>
>> On Sunday, October 12, 2014 1:53:40 AM UTC+2, Luciano Laporta Podazza 
>> wrote:
>>>
>>> Hello,
>>>
>>> I'm using locally web2py (*2.9.8*) + Shopify API (2.0.4) on Mac OS X 
>>> 10.9.5 (Python *2.7.5*) and this code works perfectly:
>>>
>>> from gluon.tools import Service
>>> service = Service()
>>> import gluon.contrib.simplejson as json
>>>
>>>
>>> def call():
>>>     session.forget()
>>>     return service()
>>>
>>>
>>> @service.json
>>> def create_order():
>>>     data = json.loads(request.body.read())
>>>     import shopify
>>>     #(API Key, Password)
>>>     shop_url = "https://%s:%[email protected]/admin"; % ('key',
>>> 'secret')
>>>     shopify.ShopifyResource.set_site(shop_url)
>>>     shop  = shopify.Shop.current
>>>     orders = shopify.Order.find(financial_status='pending')
>>>     new_order = shopify.Order()
>>>
>>>
>>>     for order in orders:
>>>         if order.order_number == data['order_number']:
>>>             clone_order(order, new_order, order.attributes)
>>>
>>>
>>> def clone_order(objfrom, objto, names):
>>>     for n in names:
>>>         if hasattr(objfrom, n):
>>>             if n in ["source_name", "cart_token", "id", "token", "name", 
>>> "checkout_token", "checkout_id"]:
>>>                 objto.n = None
>>>             elif n == "line_items":
>>>                 v = getattr(objfrom, n)
>>>                 setattr(objto, n, v)
>>>                 if objto.line_items[-1].title != "Cargo por COD":
>>>                     objto.line_items.append({"variant_id" : 972802884, 
>>> "quantity" : 1, "price": 2.5, "title": "Cargo por COD"})
>>>             elif n == "order_number":
>>>                 v = getattr(objfrom, n)
>>>                 objto.note = "Agregado COD, numero de orden vieja: #" + 
>>> str(objfrom.order_number)
>>>             else:
>>>                 v = getattr(objfrom, n)
>>>                 setattr(objto, n, v)
>>>                 objto.order_number = 1198
>>>     try:
>>>         objto.save()
>>>         objfrom.cancel()
>>>         objfrom.close()
>>>         return "Success"
>>>     except Exception, e:
>>>         return "Fail"
>>>
>>> But when deploying to server (Ubuntu 14.04 with Web2py *2.9.11* / 
>>> Python *2.7.6 -note the different python and web2py version-*) I get 
>>> this error:
>>>
>>> Traceback (most recent call last):
>>>  File "/home/www-data/web2py/gluon/restricted.py", line 224, in restricted
>>>  exec ccode in environment
>>>  File 
>>> "/home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py"
>>>  
>>> <https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py>,
>>>  line 49, in <module>
>>>  File "/home/www-data/web2py/gluon/globals.py", line 392, in <lambda>
>>>  self._caller = lambda f: f()
>>>  File 
>>> "/home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py"
>>>  
>>> <https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py>,
>>>  line 7, in call
>>>  return service()
>>>  File "/home/www-data/web2py/gluon/tools.py", line 5138, in __call__
>>>  return self.serve_json(request.args[1:])
>>>  File "/home/www-data/web2py/gluon/tools.py", line 4815, in serve_json
>>>  s = universal_caller(self.json_procedures[args[0]], *args[1:], **d)
>>>  File "/home/www-data/web2py/gluon/tools.py", line 4474, in universal_caller
>>>  return f(**arg_dict)
>>>  File 
>>> "/home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py"
>>>  
>>> <https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py>,
>>>  line 17, in create_order
>>>  orders = shopify.Order.find(financial_status='pending')
>>>  File 
>>> "/usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py",
>>>  line 385, in find
>>>  return cls._find_every(from_=from_, **kwargs)
>>>  File 
>>> "/usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py",
>>>  line 524, in _find_every
>>>  prefix_options)
>>>  File 
>>> "/usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py",
>>>  line 555, in _build_list
>>>  resources.append(cls(element, prefix_options))
>>>  File "build/bdist.linux-i686/egg/shopify/base.py", line 130, in __init__
>>>  return super(ShopifyResource, self).__init__(attributes, prefix_options)
>>>  File 
>>> "/usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py",
>>>  line 362, in __init__
>>>  self._update(attributes)
>>>  File 
>>> "/usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py",
>>>  line 952, in _update
>>>  klass = self._find_class_for(key)
>>>  File 
>>> "/usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py",
>>>  line 1016, in _find_class_for
>>>  __import__('.'.join([module.__name__, element_name]))
>>>  File "/home/www-data/web2py/gluon/custom_import.py", line 82, in 
>>> custom_importer
>>>  modules_prefix, globals, locals, [itemname], level)
>>> TypeError: Item in ``from list'' not a string
>>>
>>> I also tested it with web2py 2.9.11 *locally *and it works fine too so 
>>> I can't figure it out where the issue is.
>>>
>>> Any help will be appreciated. Thanks.
>>>
>>  -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/k5193zQX6kM/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Atte
> Luciano Laporta Podazza
>  

-- 
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