Import Error, No Module named formats - python

This is the error I get! I'm guessing I'm missing a module named formats? I'm very new to installations with django. So bear with me. Previously I had gotten error that vectorformat.formats module was missing. So I did sudo pip install vectorformats. This lead to the error I have now. See below:
from vectorformats.formats import django, geojson
ImportError: No module named formats
Django Version: 1.6.1
Exception Type: ImportError
Exception Value:
No module named formats
Exception Location: /usr/local/lib/python2.6/dist-packages/leaflet_storage/views.py in , line 25
Python Executable: /usr/bin/python
Python Version: 2.6.6

from vectorformats.Formats import ...
note the uppercase 'F'
documentation here
you'll have the same error message with django and geojson

Related

conjur python api thorwing ModuleNotFoundError: No module named 'config'

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/

Unable to get HttpNegotiateAuth module working. ImportError: DLL load failed

I have the below statement in my python file,
from requests_negotiate_sspi import HttpNegotiateAuth
though i was able to make the authentication work
getting an error - no module named 'pywin32_bootstrap'. to fix this, i tried "pip install pywin32==225"
Got another error - moduleNotFoundError: No module named 'pywintypes'. to fix this i tried pip install pypiwin32
And now i'm getting the below error
c:\programdata\anaconda3\lib\site-packages\requests_negotiate_sspi__init__.py:4: in
from .requests_negotiate_sspi import HttpNegotiateAuth # noqa
c:\programdata\anaconda3\lib\site-packages\requests_negotiate_sspi\requests_negotiate_sspi.py:11: in
import sspi
c:\programdata\anaconda3\lib\site-packages\win32\lib\sspi.py:16: in
import win32security, sspicon
E ImportError: DLL load failed: The specified procedure could not be found.
What would be the best way to get this fixed? i had a look at other similar queries on stackoverflow but could not get this resolved.
I tried doing this, and then it started to work fine without any issues
pip install pywin32==223

Pyinstaller with Django: ModuleNotFoundError: No module named 'django.contrib.admin.apps'

I'm getting an error when trying to run my packaged python application in cmd line:
ModuleNotFoundError: No module named 'django.contrib.admin.apps'
I tried the answer from pyinstaller 3.2 with django 1.10.1, but I still get the same error. The only difference is a ModuleNotFoundError rather than an ImportError. Does anyone know what I could be doing wrong?
In the PyInstaller/hooks/ location you should add the hook file and import hidden modules.
More: https://github.com/pyinstaller/pyinstaller/issues/2332

Eclipse PyDev AttributeError: 'module' object has no attribute

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

"No module" error when using Python's importlib in Django -- is the path at fault?

I'm doing something wrong with Python's importlib in my Django project, and can't figure it out. I think there is a gotcha related to paths that I don't understand.
The simplest example illustrating the error occurs when I add these statements to my project's views.py file:
import test32 # a file I created. Is legal Python.
import importlib # Django is using Python 2.7
importlib.import_module # confirms that the method exists
#importlib.import_module( 'test32' )
This works fine until I uncomment the last line. Then I get an error:
ImportError at /
No module named test32
Request Method: GET
Request URL: http://localhost:4321/
Django Version: 1.8
Exception Type: ImportError
Exception Value:
No module named test32
Exception Location: /Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/importlib/__init__.py in import_module, line 37
Python Executable: /Volumes/project663/bin/python
Python Version: 2.7.3
Python Path:
['/Volumes/project663/overall_project',
'/Volumes/project663/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
'/Volumes/project663/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg',
'/Volumes/project663/lib/python2.7/site-packages/Django-1.8-py2.7.egg',
'/Volumes/project663/lib/python27.zip',
'/Volumes/project663/lib/python2.7',
'/Volumes/project663/lib/python2.7/plat-darwin',
'/Volumes/project663/lib/python2.7/plat-mac',
'/Volumes/project663/lib/python2.7/plat-mac/lib-scriptpackages',
'/Volumes/project663/lib/python2.7/lib-tk',
'/Volumes/project663/lib/python2.7/lib-old',
'/Volumes/project663/lib/python2.7/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7',
'/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/plat-darwin',
'/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/lib-tk',
'/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/plat-mac',
'/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/plat-mac/lib-scriptpackages',
'/Volumes/project663/lib/python2.7/site-packages']
I have tried numerous variants of the import_module statement, with dots preceding names, and using the package keyword, but none of them worked. This method can't be that hard to use, so I'm sure I'm missing something obvious.
What I really want to do is put test32.py in a subdirectory, but first I'd like to get it working in the same directory as views.py.
Thank you!
One possibility is that while, in Python 2, you can still have a relative import using the
import test32
syntax, this won't work with importlib. The importlib documentation for Python 2.7 says:
This module is a minor subset of what is available in the more
full-featured package of the same name from Python 3.1 that provides a
complete implementation of import. What is here has been provided to
help ease in transitioning from 2.7 to 3.1.
I read that as importlib functioning much like Python3's import, where relative imports should be explicitly specified using the dot-syntax.
So something like:
importlib.import_module('.test32', 'full.app.path')
may work. Note the dot in front of 'test32', and I don't know your full app path, but it'll be something like 'projectname.appname' (basically, the imports used elsewhere in your Django project.

Categories