Comments (13)
Still getting this error. Code is working but the error warning needs to be fixed.
from ndg_httpsclient.
How is this still an issue? :/
from ndg_httpsclient.
Now integrated into 0.4.3 release on PyPI
from ndg_httpsclient.
Hello - I can't replicate this unfortunately. Can you provide some more info?
I've tried on Mac Yosemite with Python 2.7 and CentOS 6.6 with Python 2.6.
from ndg_httpsclient.
Mac Yosemite Python 2.7
mkvirtualenv -p /usr/local/bin/python2.7 ndg
pip install ndg-httpsclient
ls ~/.virtualenvs/ndg/lib/python2.7/site-packages/ndg/__init__.py
ls: /Users/sklass/.virtualenvs/ndg/lib/python2.7/site-packages/ndg/__init__.py: No such file or directory
Hope this helps
from ndg_httpsclient.
Thanks - now I understand. I've been blissfully unaware as though the __init__.py
file is not there the relevant packages and modules still load. e.g.
$ python
Python 2.7.9 (v2.7.9:648dcafa7e5f, Dec 10 2014, 10:10:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ndg
>>> import ndg.httpsclient
>>> dir (ndg.httpsclient)
['__author__', '__builtins__', '__contact__', '__copyright__', '__date__', '__doc__', '__file__', '__license__', '__name__', '__package__', '__path__', '__revision__']
>>> from ndg.httpsclient.https import HTTPSConnection
>>> help(HTTPSConnection)
I'm assuming this is some effect of the namespace package magic. Are there explicit things you can't do because the __init__.py
is missing?
from ndg_httpsclient.
Nope just a warning ;) I'm assuming something is tripping it but not sure what. It's an easy enough fix as the repo has it.
from ndg_httpsclient.
Any updates on this?
from ndg_httpsclient.
Sorry for the slow response. I've been researching this further. There seem to be two main approaches for namespace packages - using pkg_resources
and pkg_util
. Looking at an equivalent case like the Paste package, it has a whole family of sub-packages under the paste
namespace. The __init__.py
uses a strategy if not pkg_resources
use pkg_util
:
When I install PasteDeploy, I get the same behaviour as ndg_httpsclient: the __init__.py
is omitted. It's still not clear to me whether this is intended behaviour for namespace packages but clearly the code works.
from ndg_httpsclient.
Hi. I'm getting this in some code that includes a module from another package, but presumably something further up the line is including ndg. The warning message even comes up if I explicitly suppress all warnings. Makes things difficult to debug by clogging up logs. Python2.7 running on an old CentOS.
from ndg_httpsclient.
I'll see if I can take a look at this again
from ndg_httpsclient.
How we work around this issue (really ugly):
# turn all warnings into errors
import warnings
warnings.simplefilter('error')
# -- suppress import warnings for ndg
with warnings.catch_warnings(record=True) as ws:
warnings.simplefilter("always")
# import everything that needs ndg
# noinspection PyUnresolvedReferences
import pytz
# noinspection PyUnresolvedReferences
import rollbar
expected_error = (
"Not importing directory '", "/ndg': missing __init__.py"
)
for w in ws: # pragma: no cover
assert issubclass(w.category, ImportWarning)
assert str(w.message).startswith(expected_error[0]), str(w.message)
assert str(w.message).endswith(expected_error[1]), str(w.message)
from ndg_httpsclient.
Here is how to reproduce using Docker, using Python 2.7.6:
Dockerfile
FROM ubuntu:14.04
RUN apt-get -yqq update && apt-get -yqq install python-pip python-dev libffi-dev libxmlsec1-openssl libssl-dev
RUN pip install ndg-httpsclient==0.4.2
Build + run and you'll reproduce the warning we're all seeing:
$ docker build . -t ndgtest
$ docker run -it ndgtest python -W error -c "from pkg_resources import iter_entry_points"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2760, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 738, in subscribe
callback(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2760, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2316, in activate
declare_namespace(pkg)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1922, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1874, in _handle_ns
loader = importer.find_module(packageName)
File "/usr/lib/python2.7/pkgutil.py", line 186, in find_module
file, filename, etc = imp.find_module(subname, path)
ImportWarning: Not importing directory '/usr/local/lib/python2.7/dist-packages/ndg': missing __init__.py
Please re-open this issue @philipkershaw
Looks like this issue is attributable to the contents of ndg/__init__.py
deviating from the prescribed contents
from ndg_httpsclient.
Related Issues (11)
- version 0.3.3 does not work with python3 HOT 1
- pyasn1 is a dependency that doesn't get upgraded HOT 8
- LICENSE missing from pypi package HOT 2
- v0.4.1 was not pushed to PyPI HOT 2
- OpenSSL.SSL.WantReadError
- Wheel support HOT 1
- test certs have expired (20 Jan 2018). Could those be refreshed? HOT 3
- maximum number of alt names HOT 5
- Test certificates expired (again) HOT 4
- test suite fails with openssl 1.1.1e HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ndg_httpsclient.