I am trying to connect to the shopify api but am having difficulty connecting when using Eclipse+PyDev. When connection via python in a bash shell the same commands work OK
to install:
pip3 install --upgrade ShopifyAPI
shopify.py (my code)
import shopify
shop_url = "https://APIKEY:PASSWORD#mystore.myshopify.com/admin/products.json
shopify.ShopifyResource.set_site(shop_url)
The reference to shopify.ShopifyResouce.. throws the following in PyDev:
AttributeError: 'module' object has no attribute 'ShopifyResource'
I think it may be due to relative imports in the shopify module (the same code works fine in a terminal).
In shopify.py: (shopify API)
from shopify.resources import *
in shopify.resources: (shopify API)
from ..base import ShopifyResource
When I run
from shopify.base import ShopifyResource
ShopifyResource.set_site(shop_url)
I get ImportError: No module named 'shopify.base'; 'shopify' is not a package
Any ides how I can fix this?
The problem might be you created a shopify.py file in your IDE rename that file and that error will be solved
Related
I am trying to emulate a firmware using fermadyne and while trying to extract the zip file using "./sources/extractor/extractor.py -b Netgear -sql 127.0.0.1 -np -nk "WNAP320 Firmware Version 2.0.3.zip" images" I get the following error,
"File "./sources/extractor/extractor.py", line 17, in
import magic
ImportError: No module named magic"
I tried installing magic for python3 but the problem still persists. Any suggestions?
I am using conjur-client==0.1.0 and conjur==0.4.4, python 3.8. The exception message looks like
File "/usr/local/lib/python3.8/site-packages/conjur/__init__.py", line 22, in <module>
from config import Config
ModuleNotFoundError: No module named 'config'
So far I tried changing python version to 3.7, conjur version to older versions but have no success.
What could be the issue here?
Don't install both conjur and conjur-client on Python 3.
Based on https://pypi.org/project/Conjur/ :
If you are looking for Python3 API client, please go to our new project page at https://github.com/cyberark/conjur-api-python3.
IMPORTANT: THIS API CLIENT IS NOT CURRENTLY ACTIVELY BEING SUPPORTED
The Python 3 client is just conjur-client. https://pypi.org/project/conjur-client/
I'm running these lines
import dill
dill.load_session("session2.pkl")
and getting the error AttributeError: module 'IPython.core' has no attribute 'shadowns'.
I've saved this session on Google Colab Notebooks. How can I get rid of the error?
I used the simple workaround:
import IPython
IPython.core.shadowns = 1
For some extra packages missing like google or google.colab, I used
%%bash
mkdir google/colab
touch google/colab/__init__.py
I need to perform a BULK whois query using shodan API.
I came across this code
import shodan
api = shodan.Shodan('inserted my API-KEY- within single quotes')
info = api.host('8.8.8.8')
After running the module i get the following error:
Traceback (most recent call last):
File "C:/Users/PIPY/AppData/Local/Programs/Python/Python37/dam.py", line 1, in
import shodan
File "C:/Users/PIPY/AppData/Local/Programs/Python/Python37\shodan.py", line 2, in
api = shodan.Shodan('the above insereted API KEY')
AttributeError: module 'shodan' has no attribute 'Shodan'
I'm learning python and have limited scripting/programming experience.
Could you please help me out?
Cheers
You seem to have dam.py and shodan.py – Python defaults to importing from the module directory, so the installed shodan package gets masked.
Try renaming shodan.py to e.g. shodan_test.py (and of course fixing up any imports, etc.).
I have solved the issue by re-installing the shodan module under the C:\Users\PIPY\AppData\Local\Programs\Python\Python37\Scripts>pip install shodan
Thank you for the help AKX.
I had this same issue but after renaming my file as something different than shodan.py, I had to also delete the compiled class shodan.pyc to avoid the error.
Also, if you have more than one version of python installed, i.e. python2 and python3, use
python -m pip install shodan instead of pip install shodan, to ensure that you are installing the library in the same version of shodan that you are using to execute your script.
If you are executing your script with python3 shodan_test.py then use python3 -m pip install shodan
My goal is to acquire image from an Allied Vision camera thanks to Python (Anaconda 3.7). For that I tried to use the "Pymba" package but I get the error : “AttributeError: module has no attribute”.
I looked in the previous posts but I didn't find any working solution. I put below some of my tests.
Here is my code :
import pymba
with pymba.Vimba() as vimba:
print (vimba.getVersion())
system = vimba.getSystem()
The precise error :
File "<ipython-input-2-ff80570a1f3d>", line 3, in <module>
print (vimba.getVersion())
AttributeError: 'Vimba' object has no attribute 'getVersion'
And here are some informations that could be usefull about my research to solve this problem:
I checked if the package was correctly installed.
from pymba import Vimba, PYMBA_VERSION
print(PYMBA_VERSION)
print(Vimba.version())
0.3.2
1.7.0
Despite the fact that I don't have any other file named "Pymba", I checked what file was imported:
print(pymba.__file__)
C:\Users\agricultu\Anaconda3\lib\site-packages\pymba\__init__.py
I don't have either a previous file named "getVersion" and I get the same error for every other function of the package anyway.
I'm running out of ideas and I hope one of you will be able to help me.