Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Import failure on python 2.7.10 #54

Open
dmitrytokarev opened this issue Apr 21, 2016 · 4 comments
Open

Import failure on python 2.7.10 #54

dmitrytokarev opened this issue Apr 21, 2016 · 4 comments

Comments

@dmitrytokarev
Copy link

dmitrytokarev commented Apr 21, 2016

OS X Yosemite 10.10.5 (14F1713)
I have same python version 2.7.10 for /usr/local/bin/python and /usr/bin/python, but import fails for the latter:

mac:[~]: /usr/bin/python
Python 2.7.10 (default, Jul 14 2015, 19:46:27) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin

Type "help", "copyright", "credits" or "license" for more information.
>>> import chef
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/chef/__init__.py", line 6, in <module>
    from chef.client import Client
  File "/Library/Python/2.7/site-packages/chef/client.py", line 2, in <module>
    from chef.base import ChefObject
  File "/Library/Python/2.7/site-packages/chef/base.py", line 39, in <module>
    class ChefObject(six.with_metaclass(ChefObjectMeta, object)):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six.py", line 566, in with_metaclass
    return meta("NewBase", bases, {})
  File "/Library/Python/2.7/site-packages/chef/base.py", line 35, in __init__
    ChefObject.types[name.lower()] = cls
NameError: global name 'ChefObject' is not defined
mac:[~]: cat /Library/Python/2.7/site-packages/chef/__init__.py
# Copyright (c) 2010 Noah Kantrowitz <[email protected]>

__version__ = (0, 3, 0)

from chef.api import ChefAPI, autoconfigure
from chef.client import Client
from chef.data_bag import DataBag, DataBagItem
from chef.exceptions import ChefError
from chef.node import Node
from chef.role import Role
from chef.environment import Environment
from chef.search import Search
from chef.acl import Acl

But /usr/local/bin/python is fine:

mac:[~]: /usr/local/bin/python
Python 2.7.10 (default, Sep 23 2015, 04:34:14) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import chef
>>> chef.__version__
(0, 3, 0)
>>> 

NOTE: python 2.7.10 build ver/dates are different for /usr/local/bin/python and /usr/bin/python

@dmitrytokarev
Copy link
Author

Also if there is a minimum python version supported - that should be listed somewhere - i couldn't find that in docs, nor in codebase, nor on PyPI PyChef page...

@dmitrytokarev85
Copy link

dmitrytokarev85 commented Apr 21, 2016

On my other Mac import works (newer python 2.7.10 build):
OS X El Capitan 10.11.4

$: python
Python 2.7.10 (default, Nov 10 2015, 08:39:11) 
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import chef
>>> chef.__version__
(0, 3, 0)

I guess it's the older Python 2.7.10 build (Jul 14 2015, 19:46:27) is the problem here. Possibly other older Python versions would throw same error...

@kshcherban
Copy link

Caught same issue with python 2.7.6 and pychef 0.3.0

@tylerthueson
Copy link

Same issue with Python 2.7.6 and latest pychef.

NameError: global name 'ChefObject' is not defined

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants