Re: help me...

Magnus Lie Hetland <[email protected]> Thu, 30 Sep 2004 13:43:37 +0200
Newsgroups gmane.comp.python.anygui.general
Message-ID <[email protected]>
st*rbrite <[email protected]>:
>
> I have downloaded Anygui.
> I am using Python Win on XP operating sys.
> I am learning Python; self-teaching myself from the Practical Python
> book.
>  
> I am having problems implementing the app = Application( ) 
> I get the following error:
>  
> Traceback (most recent call last):
>   File
> "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py"

Hm. I'm not quite familiar with the scriptutils part of the PythonWin
framework, really... I guess it may be interacting unfavourably with
the way Anygui dynamically loads things, perhaps?

> , line 310, in RunScript
>     exec codeObject in __main__.__dict__
>   File "C:\Documents and Settings\M&I\My Documents\Python Programs\Gui
> test.py", line 2, in ?
>     app = Application()
> NameError: name 'Application' is not defined 
>  
> This is my Python Script:
>  
> from anygui import *
> app = Application()
[snip]

Well, if things were working as they should, you should *not* be
getting a NameError here. It does seem that the RunScript thing (which
gives the error) messes directly with namespaces etc., which Anygui
also does. I would guess that running your program with an ordinary
Python interpreter would (or, at least, could ;) work...

[snip]
> I had this issue before and I reinstalled Anygui.  It seemed to help,
> but in the middle of my work, after successfully creating my 'box',
> I ran it again and I received the above error.

Very strange. As I said, this seems to be some problem in the
interaction between Anygui and the PythonWin RunScript thing. I'm not
sure how it works -- you could perhaps ask on a PythonWin list?

A possible solution would be to import things directly from the
back-end of your choice. E.g.,

  from anygui.backends.mswgui import *
  app = Application()
  ...

If you're running PythonWin, I guess the mswgui back-end should work.

> Please Help.  is it just me. am I missing something.

No, I don't think you're doing anything wrong -- at least not as far
as I can see.

> lol; Thank you
> Monica.

-- 
Magnus Lie Hetland       Fallen flower I see / Returning to its branch
http://hetland.org       Ah! a butterfly.           [Arakida Moritake]


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl