question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to import Policies - PIP package not up to date

See original GitHub issue

Using 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:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jfilakcommented, Sep 9, 2019

We have to update the pip package.

0reactions
filak-sapcommented, Oct 21, 2019

Thank you, @phanak-sap for updating the package in pypi.

@MKaras93 Please, re-test and re-open if necessary.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found