omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Celery import error

    Pythonista
    2
    4
    4123
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • khilnani
      khilnani last edited by khilnani

      I was able to pip install celery, but whem i try to import i get an error on import from the kombu package it depends on

      from kombu.five import monotonic
        File "/private/var/mobile/Containers/Shared/AppGroup/6A6950F6-86D6-46AB-96BD-0E55FFAEC184/Pythonista3/Documents/site-packages/kombu/five.py", line 56, in <module>
          absolute_to_nanoseconds = CoreServices.AbsoluteToNanoseconds
        File "/var/containers/Bundle/Application/ACE4580A-901E-4AC9-8BA1-EEBF5F98373A/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/ctypes/__init__.py", line 378, in __getattr__
          func = self.__getitem__(name)
        File "/var/containers/Bundle/Application/ACE4580A-901E-4AC9-8BA1-EEBF5F98373A/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/ctypes/__init__.py", line 383, in __getitem__
          func = self._FuncPtr((name_or_ordinal, self))
      AttributeError: dlsym(RTLD_DEFAULT, AbsoluteToNanoseconds): symbol not found
      

      the code at thr line with the issue is

      if SYSTEM == 'Darwin' and ctypes is not None:
              from ctypes.util import find_library
              libSystem = ctypes.CDLL(find_library('libSystem.dylib'))
              CoreServices = ctypes.CDLL(find_library('CoreServices'),
                                         use_errno=True)
              mach_absolute_time = libSystem.mach_absolute_time
              mach_absolute_time.restype = ctypes.c_uint64
              absolute_to_nanoseconds = CoreServices.AbsoluteToNanoseconds  ##error##
              absolute_to_nanoseconds.restype = ctypes.c_uint64
              absolute_to_nanoseconds.argtypes = [ctypes.c_uint64]
      

      I'm just trying to see if celery works at all when using sqlite, example

      from celery import Celery
      app = Celery('hello', broker='sqla+sqlite:///celerydb.sqlite')
      

      Thanks!!!!!!

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by JonB

        you could replace the last 3 lines with

        absolute_to_nanoseconds = lambda t:1000*t

        Thoughh there is a good chance something else will fail

        1 Reply Last reply Reply Quote 1
        • khilnani
          khilnani last edited by

          i could patch it but its a dependency of celery, so might become a bit wieldy soon.

          i was wondering if anyone (or @omz ) knew why it might be failing and its something missing on iOS thats availablenon desktop

          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            @khilnani said:
            Because it uses depreciated functions, and more importantly functions which are not
            supported on iOS. Technically, there might be a way to patch ctypes before you import to always return the same object, which you can then pre-patch to contain the faked method. On iOS dynamic loading is not allowed, so only static libraries that were compiled in are available, as well as NSBundles.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors