Unable to import Policies - PIP package not up to date
See original GitHub issueUsing version 1.2.3
from PIP
. I have a problem with accessing a specific API. I’m receiving an error:
.virtualenvs/project/lib/python3.6/site-packages/pyodata/v2/model.py", line 138, in parse_type_name
is_collection = type_name.lower().startswith('collection(') and type_name.endswith(')')
AttributeError: 'NoneType' object has no attribute 'lower'
In the docs I found information that this can be due to invalid metadata. I’ve tried to overcome the issue as advised in the docs:
import pyodata
from pyodata.v2.model import PolicyFatal, PolicyWarning, PolicyIgnore, ParserError, Config
import requests
SERVICE_URL = 'http://services.odata.org/V2/Northwind/Northwind.svc/'
namespaces = {
'edmx': 'customEdmxUrl.com',
'edm': 'customEdmUrl.com'
}
custom_config = Config(
xml_namespaces=namespaces,
default_error_policy=PolicyFatal(),
custom_error_policies={
ParserError.ANNOTATION: PolicyWarning(),
ParserError.ASSOCIATION: PolicyIgnore()
})
northwind = pyodata.Client(SERVICE_URL, requests.Session(), config=custom_config)
The problem is that PolicyFatal
, PolicyWarning
and PolicyIgnore
are not in the model.py
, so I can’t import them. Is it a bug or am I using a wrong version? I installed it from PIP, it’s pyodata 1.2.3.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
python - Unable to import a module that is definitely installed
In my case, it is permission problem. The package was somehow installed with root rw permission only, other user just cannot rw to...
Read more >How to Update All Python Packages - ActiveState
Update all Python Packages on Windows · Open a command shell by typing 'powershell' in the Search Box of the Task bar ·...
Read more >User Guide - pip documentation v22.3.1
In a --system-site-packages virtualenv, pip will not install a package that conflicts with a package in the virtualenv site-packages. The --user installation ...
Read more >Using Python's pip to Manage Your Projects' Dependencies
In this example, you run pip with the install command followed by the name of the package that you want to install. The...
Read more >5. The import system — Python 3.11.1 documentation
It's important to keep in mind that all packages are modules, but not all modules are packages. Or put another way, packages are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We have to update the pip package.
Thank you, @phanak-sap for updating the package in pypi.
@MKaras93 Please, re-test and re-open if necessary.