Environment Introduction
Basic Python Basics Tutorial (2nd edition revision) [Noah] Magnus Lie hetland introductions Zeng Tan Yinghua translation
Operating system: CentOS release 6.9 (Final)
Python version: Python 2.6.6
Program Editor: Vim-vi improved 7.4
WxPython version: wxpython-2.8.12.0-1.el6.x86_64
Program Source code:
#!/usr/bin/env python
Import WX
App = WX. APP ()
Win = WX. Frame (None)
Win. Show ()
App. Mainloop ()
Error:
[email protected] python]# python wx.py
Traceback (most recent):
File "wx.py", line 2, <module>
Import WX
File "/root/python/wx.py", line 3, <module>
App = WX. APP ()
Attributeerror: ' Module ' object has no attribute ' App '
Find the answer online:
Problem Solving methods:
1. When naming the Py script, do not match the python reserved word, module name, etc.
2. Delete the. pyc file for the library (because the. pyc file is generated by the PY script each time it is run; If the code is not updated, the runtime will still walk PYc when the. pyc file is generated, so delete the. pyc file), rerun the code, or find an environment where you can run the code, and copy the. pyc file to replace the
Solve:
Change the wx.py to editor.py execute successfully pops up a text box, such as an attachment:
[email protected] python]# python editor.py
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/9D/C1/wKiom1mFV9_gUbx2AAGeZjybDIk903.png-wh_500x0-wm_ 3-wmp_4-s_2108383828.png "title=" Clipboard.png "alt=" Wkiom1mfv9_gubx2aagezjybdik903.png-wh_50 "/>
This article is from "daming site" blog, please be sure to keep this source http://damingzone.blog.51cto.com/3892167/1953796
Attributeerror: ' Module ' object has no attribute ' App '