tkFileDialog -> ImportError: No module named shell

Mike Driscoll kyosohma at gmail.com
Mon Apr 13 15:57:39 EDT 2009


On Apr 13, 2:29 pm, Alan G Isaac <alan.is... at gmail.com> wrote:
> > On Apr 13, 11:26 am, Alan G Isaac <alan.is... at gmail.com>
> > wrote:
> >> Why do I get the ImportError below?
> >> What is the right way to do this?
> >> Thanks,
> >> Alan Isaac
> >> Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC
> >> v.1310 32 bit (Intel)] on win32 Type "help", "copyright",
> >> "credits" or "license" for more information.
> >>  >>> import Tkinter as tk
> >>  >>> root=tk.Tk()
> >>  >>> import tkFileDialog
> >>  >>> fh = tkFileDialog.asksaveasfile()
> >> Traceback (most recent call last):
> >>    File "boot_com_servers.py", line 44, in <module>
> >>    File "tbzr.pyo", line 125, in <module>
> >>    File "tbzr.pyo", line 60, in get_all_com_classes
> >>    File "contextmenu.pyo", line 9, in <module>
> >> ImportError: No module named shell
> >> Redirecting output to win32trace remote collector
>
> On 4/13/2009 2:28 PM Mike Driscoll apparently wrote:
>
> > Well, if you have tortoisehg installed, uninstall it. That was what
> > was giving me this exact error with wxPython file dialogs.
>
> No, I don't have tortoisehg.
> But, I do have Bazaar installed,
> and that is the only place I see contextmenu.pyo.
>
> And that appears to be the source of the problem:https://bugs.launchpad.net/bzr/+bug/305085
>
> Can you help me understand how
> another application can interfere with Tkinter
> in such a fashion?
>
> Thank you!
> Alan Isaac

Here's my (probably flawed) understanding of what tortoisehg does:
According to their bug report, there's a dll mismatch that causes the
issue (see http://bitbucket.org/tortoisehg/stable/issue/67/thg-conflicts-with-other-python).

I haven't had any issues with IDLE and bzr as of yet, and it
definitely hasn't given my Wingware IDE any issues either. I wonder if
you need to just upgrade to the latest bzr to see if that fixes the
issue. I have a pretty old one (1.8)...then again, I'm using wxPython,
not Tkinter.

Anyway, somehow these DVCSes are messing with the shell itself, which
is what a file dialog tries to open too. When the file dialog goes to
open it, it executes some code automagically in the DVCS and then
crashes.

Hopefully someone else with more knowledge will step in and give us a
clue.

Mike



More information about the Python-list mailing list