0

This is a web tutorial explaining how to install wxPython(3rd link from the list is the version that i have installed).

Also my Python version is Python 2.6.2

Whenever i try to type (according to tutorial)

import wx app=wx.App() win=wx.Frame(None) win.Show() app.MainLoop() 

then save it and run it i receive the following message in GUI Python Shell:

Traceback(most recent call last): File "E:/Python26/sdf", line 1, in <module> import wx File "E:/Python26\wx.py", line 2, in <module> app=wx.App() AttributeError: 'module' object has no attribute 'App' 

You can also see it in a pic... pic.

Why is this happening while in the tutorial wxPython works flawlesly???

How i can bypass this problem??

6
  • What is your script file's name? Commented Apr 4, 2014 at 15:20
  • sdf just that i gave it a random name Commented Apr 4, 2014 at 15:22
  • Try going to the python console and typing import wx and see if you get the same problem. Commented Apr 4, 2014 at 15:24
  • Yes I do i typed it on the GUI and I am still having the same problem Commented Apr 4, 2014 at 15:25
  • Not the IDLE, try the command line. Go to cmd/sh and type python >> Enter >> import wx >> Enter. See what happens Commented Apr 4, 2014 at 15:26

1 Answer 1

1

It looks like you named your script "wx.py" and put it in your root Python directory: C:\Python26. This is part of the search path that Python uses when it imports modules. It finds your wx.py and imports it instead of the real wx package. Save your script with a name that does not conflict with the module you are trying to import.

Sign up to request clarification or add additional context in comments.

3 Comments

Just a sec to check it plz
Godbless you it works!!! I didn't use any py or pyc extension while saving it; I just saved it as tuna and no extension. Should I use any extension?
You should still use the .py extension

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.