New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'PBXGenericObject' is not defined #185

Closed
justbilt opened this Issue Dec 1, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@justbilt

justbilt commented Dec 1, 2017

Traceback:

iMac:package justbilt$ python test.py
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    from pbxproj import XcodeProject
  File "/Library/Python/2.7/site-packages/pbxproj/__init__.py", line 24, in <module>
    from pbxproj.PBXGenericObject import PBXGenericObject
  File "/Library/Python/2.7/site-packages/pbxproj/PBXGenericObject.py", line 6, in <module>
    standard_library.install_aliases()
  File "/Library/Python/2.7/site-packages/future/standard_library/__init__.py", line 483, in install_aliases
    import test
  File "/Users/justbilt/Documents/work/package/test.py", line 6, in <module>
    from pbxproj import XcodeProject
  File "/Library/Python/2.7/site-packages/pbxproj/XcodeProject.py", line 3, in <module>
    from pbxproj.pbxextensions import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxextensions/__init__.py", line 1, in <module>
    from pbxproj.pbxextensions.ProjectFiles import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxextensions/ProjectFiles.py", line 1, in <module>
    from pbxproj.pbxsections import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxsections/__init__.py", line 1, in <module>
    from pbxproj.pbxsections.PBXBuildFile import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxsections/PBXBuildFile.py", line 4, in <module>
    class PBXBuildFile(PBXGenericObject):
NameError: name 'PBXGenericObject' is not defined

test.py

#!/usr/bin/env python  
# coding=utf-8  
# Python 2.7.3  
from pbxproj import XcodeProject

Python version:

Python 2.7.10

pbxproj version:

iMac:package justbilt$ pip show pbxproj
Name: pbxproj
Version: 2.2.2
Summary: XCode Project manipulation library for Python
Home-page: http://github.com/kronenthaler/mod-pbxproj
Author: Ignacio Calderon
Author-email: UNKNOWN
License: MIT License
Location: /Library/Python/2.7/site-packages
Requires: openstep-parser, docopt, future

And it work fine when i changed PBXBuildFile.py :

from pbxproj import *
from pbxproj import PBXGenericObject
@kronenthaler

This comment has been minimized.

Show comment
Hide comment
@kronenthaler

kronenthaler Dec 1, 2017

Owner

I had this very same issue recently, change the name of your script from test.py to something else. The future libraries (python 3 compatibility) are the culprit here.

Owner

kronenthaler commented Dec 1, 2017

I had this very same issue recently, change the name of your script from test.py to something else. The future libraries (python 3 compatibility) are the culprit here.

@justbilt

This comment has been minimized.

Show comment
Hide comment
@justbilt

justbilt Dec 1, 2017

Thanks for your reply.

I tried your way, changed my test.py to a.py or something else, it still no pass. I even tried those script in interactive command line:

iMac:package justbilt$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pbxproj import XcodeProject
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/pbxproj/__init__.py", line 24, in <module>
    from pbxproj.PBXGenericObject import PBXGenericObject
  File "/Library/Python/2.7/site-packages/pbxproj/PBXGenericObject.py", line 6, in <module>
    standard_library.install_aliases()
  File "/Library/Python/2.7/site-packages/future/standard_library/__init__.py", line 483, in install_aliases
    import test
  File "/Users/justbilt/Documents/work/package/test.py", line 6, in <module>
  File "/Library/Python/2.7/site-packages/pbxproj/XcodeProject.py", line 3, in <module>
    from pbxproj.pbxextensions import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxextensions/__init__.py", line 1, in <module>
    from pbxproj.pbxextensions.ProjectFiles import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxextensions/ProjectFiles.py", line 1, in <module>
    from pbxproj.pbxsections import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxsections/__init__.py", line 1, in <module>
    from pbxproj.pbxsections.PBXBuildFile import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxsections/PBXBuildFile.py", line 4, in <module>
    class PBXBuildFile(PBXGenericObject):
NameError: name 'PBXGenericObject' is not defined
>>>

so what should i do ?

justbilt commented Dec 1, 2017

Thanks for your reply.

I tried your way, changed my test.py to a.py or something else, it still no pass. I even tried those script in interactive command line:

iMac:package justbilt$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pbxproj import XcodeProject
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/pbxproj/__init__.py", line 24, in <module>
    from pbxproj.PBXGenericObject import PBXGenericObject
  File "/Library/Python/2.7/site-packages/pbxproj/PBXGenericObject.py", line 6, in <module>
    standard_library.install_aliases()
  File "/Library/Python/2.7/site-packages/future/standard_library/__init__.py", line 483, in install_aliases
    import test
  File "/Users/justbilt/Documents/work/package/test.py", line 6, in <module>
  File "/Library/Python/2.7/site-packages/pbxproj/XcodeProject.py", line 3, in <module>
    from pbxproj.pbxextensions import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxextensions/__init__.py", line 1, in <module>
    from pbxproj.pbxextensions.ProjectFiles import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxextensions/ProjectFiles.py", line 1, in <module>
    from pbxproj.pbxsections import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxsections/__init__.py", line 1, in <module>
    from pbxproj.pbxsections.PBXBuildFile import *
  File "/Library/Python/2.7/site-packages/pbxproj/pbxsections/PBXBuildFile.py", line 4, in <module>
    class PBXBuildFile(PBXGenericObject):
NameError: name 'PBXGenericObject' is not defined
>>>

so what should i do ?

@kronenthaler

This comment has been minimized.

Show comment
Hide comment
@kronenthaler

kronenthaler Dec 1, 2017

Owner
Owner

kronenthaler commented Dec 1, 2017

@justbilt

This comment has been minimized.

Show comment
Hide comment
@justbilt

justbilt Dec 2, 2017

Oh my, unbelievable. You are right, thanks a lot !

justbilt commented Dec 2, 2017

Oh my, unbelievable. You are right, thanks a lot !

@sebrk

This comment has been minimized.

Show comment
Hide comment
@sebrk

sebrk Feb 19, 2018

Jesus I spent a few hours on this... thanks

sebrk commented Feb 19, 2018

Jesus I spent a few hours on this... thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment