Oslo.config cfg.py throws deprecation warning

Bug #1411674 reported by Doug Chivers
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.config
Fix Released
Undecided
Doug Chivers

Bug Description

I get a deprecation message when using oslo config:

$ .venv/bin/pecan serve config_pecan.py
2015-01-16 12:14:45,379 WARNI [py.warnings][21870/MainThread]
./.venv/lib/python2.7/site-packages/oslo_config/cfg.py:333: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
  from oslo.config import iniparser

I am importing oslo config as follows:

from oslo_config import cfg

This is the latest availible oslo_config, installed using pip.

affects: pbr → oslo.config
Revision history for this message
Longjie_Cao (grasson1101) wrote :

Can you provide more information about the ./.venv/lib/python2.7/site-package/ and ./.venv/local/lib/python2.7/site-package?

Revision history for this message
Longjie_Cao (grasson1101) wrote :

My test for pecan can work, please forgive me if I am not doing the same thing as you did:
virtualenv oslo-app
cd oslo-app
source bin/activate
pip install pecan
pip install oslo.config
pecan create pecanrest
cd pecanrest
python setup.py develop
pecan serve config.py

The result is as:
(oslo-app)root@ubuntu2:~/workdir/project/oslo-app/pecanrest# pecan serve config.py
Starting server in PID 15632
serving on 0.0.0.0:8080, view at http://127.0.0.1:8080

Revision history for this message
Doug Chivers (doug-chivers) wrote :

The reason this appeared in pecan is because I have debug enabled, which causes deprecation warnings to be shown. This can be demonstrated as follows.

Create a new virtual env and install oslo config:

$ virtualenv oslotest
$ . oslotest/bin/activate
$ pip install oslo.config

Configure python to show deprecation warnings:

$ python
>>> import logging, warnings
>>> from logging import captureWarnings
>>> logging.basicConfig()
>>> captureWarnings(True)
>>> warnings.simplefilter("default", DeprecationWarning)

Test a deprecation warning:

>>> warnings.warn('hello world',DeprecationWarning)
WARNING:py.warnings:__main__:1: DeprecationWarning: hello world

Import oslo.config:

>>> import oslo.config
WARNING:py.warnings:__main__:1: DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.

This message is from this file: https://github.com/openstack/oslo.config/blob/master/oslo/config/__init__.py

Changed in oslo.config:
status: New → Fix Committed
assignee: nobody → Doug Chivers (doug-chivers)
Revision history for this message
sumesh (ssumesh) wrote :

please give a solution for my glance installation (image service installation) under ubuntu 14.04 lts openstack

When I am executing the command
      su -s /bin/sh -c "glance-manage db_sync" glance

Traceback (most recent call last):
  File "/usr/bin/glance-manage", line 6, in <module>
    from glance.cmd.manage import main
  File "/usr/lib/python2.7/dist-packages/glance/cmd/manage.py", line 41, in <module>
    from oslo.config import cfg
ImportError: No module named config

So I tried the command

$ python

and tried to execute the instruction
>>> import oslo.config
The system gives the error as given below

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named config

So please give a solution for this problem Please ......................

Revision history for this message
Doug Chivers (doug-chivers) wrote :

please try:

$ python

>>> import oslo_config

Revision history for this message
sumesh (ssumesh) wrote :

Thank you for your replay
I tried the command but this is the error

$python
>>> import oslo_config
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named oslo_config

Please give solution ...........................

Changed in oslo.config:
milestone: none → 1.7.0
status: Fix Committed → Fix Released
Revision history for this message
Doug Chivers (doug-chivers) wrote :

@sumesh stupid question, you do have oslo.config installed?

$ pip install oslo.config

Revision history for this message
Amit (amit1-behera) wrote :

I faced the same problem

Below helped me to resolve the issue
pip install oslo.config --upgrade

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.