Attributeerror: ' Module ' object has no attribute ' App '

Source: Internet
Author: User

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 '

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.