Is there a way to import a library in Zapier Python Code?
Specifically, I want the 'datasift' library.
When I try, I just get "ImportError: No module named datasift"
In the zapier documentation, it specifically says that it only allows for the requests import and standard python imports
We can import only requests, so we need to find another way to run any python code which include the other libraries.
Maybe, we can build python to exe file and run it directly by zapier service.
Related
I have been coding in python for about 2 months, but I'm only familiar with basic object-oriented programming, so I do not really understand things like how searching for modules is implemented. (Basically I'm a noob.)
I pip installed a package called Opentrons Opentrons 2.5.2 and all its dependencies into the samefolder as a python script I'm currently writing. However when I tried to import the module below[1], I get an error saying that "Opentrons is not a module". Then, I tried shifting it into the python library because I found out the search path using the pprint module and it seems to work. I was wondering if I can specify the search path from the .py file itself instead of manually printing the search path and putting the file into the library that the script searches for. (Willing to put in images of the directories I put the opentrons package in if it helps.)
[1]
import sys
import pprint
pprint.pprint(search.path)
from opentrons import robot, containers, instruments
Edit: I realise that the fact that I am running all my scripts in a Spyder console located in a python 3.6 environment might be important.
You can try using the __import__ function, or importlib. This should allow you to specify the path.
I have a problem with chapter 4 of this book. I run python shell (IDLE, python 2.7) and try to import apihelper module, but I keep getting traceback saying
No module named apihelper
I downloaded the code from Pilgrim's site, but it still doesn't work. What do I miss?
That's because your Python interpreter doesn't know where did you download apihelper module, and it cannot import it.
More about where does import look for packages you can read here in Dive into Python book.
I am writing a series of python scripts to extend the QGIS software suite. As such I am trying to follow their naming conventions. In this instance the file I am trying to import is called "r.sun.distributed". Ive tried using import r.sun.distributed and import("r.sun.distributed") However, python says it can't find a module by that name in both cases.
Is there a work around, or do I need to rename my scripts so they fit Python's conventions?
You can use the imp module to import modules without .py extension:
import imp
imp.load_source(path)
you have to convert it to .pyc to call it.
import py_compile
py_compile.compile('filename.py')
I have installed google-api-python-client library using pip3.4 Iam following tutorial from google authenicating client library so every time i run the python code provided by google to authenticate client library throws error as
import clientsecrets ImportError: No module named 'clientsecrets'
I have only python3.4 running on my pc and no other python. it might be similar thread to one here Python can't find module 'clientsecrets' when trying to set up oauth2 in Django using the Google Python API
but i found no solution there.
The python code i got from google is here
https://developers.google.com/maps/documentation/tracks/auth#authenticating_using_a_client_library
The library doesn't support Python 3. As of PEP 404:
In Python 3, implicit relative imports within packages are no longer available - only absolute imports and explicit relative imports are supported.
The oauth2client library uses import clientsecrets, which for Python 3 would need to be rewritten as from . import clientsecrets. Even if you changed those, the rest of the library would still be incompatible with Python 3.
There's at least one fork for Python 3 development, but it doesn't seem to be a big priority for the project. Until then, you'll have to find another library or write a wrapper yourself with requests for the functionality you need.
I'm using cx_Freeze to freeze my Python code so I can distribute it as executable on Windows systems. It works fine but it's missing a few modules. I use some open-source libraries in my project e.g. BeautifulSoup and Periscope. They use some libraries for backward compatibility which i don't need to include as Python 2.6 has them. The problem is the third import — multiprocessing._multiprocessing. Can anyone tell me what I need to install in order to fix this? The mutiprocessing module seems to come bundled with Python so what's causing this error?
Missing modules:
? cjkcodecs.aliases imported from BeautifulSoup.BeautifulSoup
? iconv_codec imported from BeautifulSoup.BeautifulSoup
? multiprocessing._multiprocessing imported from multiprocessing.forking
? xdg.BaseDirectory imported from periscope.periscope
Any help?
Thanks guys!
There was a similar issue on Google App Engine. See this
I fixed this my putting a _multiprocessing.py file into the multiprocessing module's folder. This file contained the code:
import multiprocessing
This works but it isn't a robust answer.