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:%s...@myshop.myshopify.com/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 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/d/optout.