【问题标题】:python rumps not working on OS X 10.10 - AttributeError: 'module' object has no attribute 'App'python 臀部不适用于 OS X 10.10 - AttributeError: 'module' object has no attribute 'App'
【发布时间】:2014-12-17 05:12:20
【问题描述】:

我正在尝试从http://rumps.readthedocs.org/en/latest/examples.html 运行一些演示 使用 Ridiculously Uncomplicated Mac os x Python Statusbar 应用程序并在导入臀部时我得到:AttributeError: 'module' object has no attribute 'App'

Mac-28cfe915100b-2:Desktop andi$ pip install rumps
Requirement already satisfied (use --upgrade to upgrade): rumps in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): pyobjc-core in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC (from rumps)
Cleaning up...
Mac-28cfe915100b-2:Desktop andi$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[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 rumps
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "rumps.py", line 4, in <module>
    class AwesomeStatusBarApp(rumps.App):
AttributeError: 'module' object has no attribute 'App'

【问题讨论】:

    标签: python macos user-interface osx-yosemite


    【解决方案1】:

    rumps 无关,而是您将演示复制到名为“rumps.py”的文件中。在您尝试从同名文件导入的任何其他模块中都会发生相同的错误。

    $ echo "import math; math.sqrt(42)" > math.py
    $ python
    Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
    [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import math
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "math.py", line 1, in <module>
        import math; math.sqrt(42)
    AttributeError: 'module' object has no attribute 'sqrt'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-26
      • 2014-12-20
      • 2022-12-01
      • 2022-12-01
      • 1970-01-01
      • 2012-02-29
      • 2013-07-26
      相关资源
      最近更新 更多