Bugs item #1904798, was opened at 2008-02-29 10:25 Message generated for change (Settings changed) made by sborho You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=968354&aid=1904798&group_id=199155
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: Extension >Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: interference with python programs Initial Comment: If you try to develop a wxPython program and you have MercurialHg installed, your wx.FileDialog will not work as expected. Also WingIDE 3.0.3 hangs of file dialogs when MercurialHg is installed. There is some discussion in http://sourceforge.net/mailarchive/forum.php?thread_name=A46CBF978138744AAC019E6FF055EAB70F30AE%40apatlelsmail08.elsys.gtri.org&forum_name=tortoisehg-develop ---------------------------------------------------------------------- Comment By: Jason (sevenseeker) Date: 2008-06-30 12:26 Message: Logged In: YES user_id=1666063 Originator: NO Is this a win32all bug? ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-05-12 00:47 Message: Logged In: YES user_id=411637 Originator: NO I just tried out the free version of Wing IDE 3.1, and am able to recreate the hangup. The outcome of my investigation so far seemed to agree with you on the matter of application process space. The debug trace indicated that Wing IDE somehow overrides TortoiseHg's bundled Python libraries with it's owned, which might have led to the hang up on the file dialog. Though I don't know the whole library handling topic well enough to understand what's really going on behind, nor a permanent fix on this problem. As of now, I have two suggestions on the workaround: 1. Install TortoiseHg from source. Somehow the overlay extension doesn't kick in within WingIDE's file dialog when TortoiseHg is installed from source. 2. In the binary installer, detect that WingIDE is running and raise an exception during initialization. This has a effect of disrupting the overlay extensions and render them ineffective. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-05-10 03:40 Message: Logged In: NO Yes I was the opener of this bug. I think, this bug is due to the poor architecture of the MS windows shell extensions, which forces applications which use the file open/save dialog to load the shell extension DLLs in its process space. A better solution would be to keep the shell extensions as separate processes. I can imagine, restructuring TortoiseHG with a small shell extension written in "C", and all the rest in a separate process, is not simple task. However, the output of the filedialog.py script on my system: Microsoft Windows XP [Versione 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\parodi>cd Desktop C:\Documents and Settings\parodi\Desktop>filedialog.py before file dialog sys is <module 'sys' (built-in)> sys.api_version is 1013 sys.executable is C:\Python25\python.exe sys.hexversion is 33882864 sys.path is ['C:\\Documents and Settings\\parodi\\Desktop', 'C:\\WINDOWS\\system 32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib \\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\si te-packages', 'C:\\Python25\\lib\\site-packages\\PIL', 'C:\\Python25\\lib\\site- packages\\pythonutils', 'C:\\Python25\\lib\\site-packages\\win32', 'C:\\Python25 \\lib\\site-packages\\win32\\lib', 'C:\\Python25\\lib\\site-packages\\Pythonwin' , 'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode'] sys.version is 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Int el)] sys.version_info is (2, 5, 2, 'final', 0) sys.stderr is <open file '<stderr>', mode 'w' at 0x0099F0B0> sys.stdout is <open file '<stdout>', mode 'w' at 0x0099F068> sys has not attribute "frozen" saving stdout running file dialog ... Redirecting output to win32trace remote collector stdout had been redirected to <PyTraceObject object at 0x00B99F20> after file dialog sys is <module 'sys' (built-in)> sys.api_version is 1013 sys.executable is C:\Python25\python.exe sys.hexversion is 33882864 sys.path is ['C:\\Documents and Settings\\parodi\\Desktop', 'C:\\WINDOWS\\system 32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib \\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\si te-packages', 'C:\\Python25\\lib\\site-packages\\PIL', 'C:\\Python25\\lib\\site- packages\\pythonutils', 'C:\\Python25\\lib\\site-packages\\win32', 'C:\\Python25 \\lib\\site-packages\\win32\\lib', 'C:\\Python25\\lib\\site-packages\\Pythonwin' , 'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\Programmi\\Tortoi seHg\\library.zip'] sys.version is 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Int el)] sys.version_info is (2, 5, 2, 'final', 0) sys.stderr is <PyTraceObject object at 0x00B99F20> sys.stdout is <open file '<stdout>', mode 'w' at 0x0099F068> sys.frozen is dll C:\Documents and Settings\parodi\Desktop> ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-05-10 01:52 Message: Logged In: YES user_id=411637 Originator: NO OK. I think I am getting a little confused. Fabio is able to run the filedialog.py and able to bring up the file dialog without hangup, but sys.stdout has been redirected to win32trace. However, WingIDE has the file dialog completely lock up. I wonder if they are pointing to the same problem. Fabio: are you the OP of this bug item? ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-05-10 01:33 Message: Logged In: YES user_id=411637 Originator: NO fabioparodi: can you rerun your script and post the output again? I am trying to match your output to see where the discrepancies are. ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-05-10 00:57 Message: Logged In: YES user_id=411637 Originator: NO BTW, I still can't recreate the problem on my system. So, any fix I can propose will be a guess at best. ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-05-10 00:55 Message: Logged In: YES user_id=411637 Originator: NO fabioparodi: thanks for posting the test script. BTW, I wonder if WingIDE is using Pythonwin also, and what version. Naturally removing TortoiseHg would the 'ultimate' fix to the issue, but that doesn't help us in any way. It simply forces users to make a choice between WingIDE and TortoisHg. Steve: I will give it a try. ---------------------------------------------------------------------- Comment By: Steve Borho (sborho) Date: 2008-05-09 09:35 Message: Logged In: YES user_id=12062 Originator: NO TK: would the following hack work in hgproc.py and context.py? import win32traceutil traceh = sys.stdout sys.stdout = sys.__stdout__ Then, wherever we have print statements, change them to: print >> traceh, "trace message" ---------------------------------------------------------------------- Comment By: Fabio Parodi (fabioparodi) Date: 2008-05-09 09:13 Message: Logged In: YES user_id=1762228 Originator: NO The new WingIDE 3.1 is suggesting its users to remove MercurialHG because of this bug. Inline my latest filedialog.py with some diagnostic added. import sys import win32gui, win32con def dumpsys(): print 'sys is', sys for a in ['api_version', 'executable', 'hexversion', 'path', 'version', 'version_info', 'stderr', 'stdout']: print 'sys.%s is' % a, getattr(sys, a) if hasattr(sys, 'frozen'): print 'sys.frozen is', sys.frozen else: print 'sys has not attribute "frozen"' def filedialog(): win32gui.GetOpenFileNameW( Flags=win32con.OFN_EXPLORER, DefExt='py', Filter="", CustomFilter="", FilterIndex=1) print 'before file dialog' dumpsys() print 'saving stdout' old_stdout = sys.stdout print 'running file dialog ...' print filedialog() if sys.stdout is not old_stdout: new_stdout = sys.stdout sys.stdout = old_stdout print print 'stdout had been redirected to', new_stdout print print 'after file dialog' dumpsys() ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-05-08 19:16 Message: Logged In: YES user_id=411637 Originator: NO The Overlay Icons option doesn't stop the overlay extension from running. It simply tells the overlay extension not to retrieve the status of the repos. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-05-08 11:48 Message: Logged In: NO Does disabling overlays make the problem go away (I think that can be done from the TortoiseHG options screen)? Could it be a problem with the overlay DLL being loaded into any process that creates a standard windows file dialog, causing a potential clash between python runtimes? ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-05-08 00:42 Message: Logged In: YES user_id=411637 Originator: NO fabioparodi: can you please post your latest filedialog.py? ---------------------------------------------------------------------- Comment By: Jason (sevenseeker) Date: 2008-05-07 16:52 Message: Logged In: YES user_id=1666063 Originator: NO Problem exists with 0.4RC2. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-04-12 01:53 Message: Logged In: NO Installed the new TortoiseHg-0.4rc1.exe, get the same behaviour. The bug is still there. Is there anything I can do for help? ---------------------------------------------------------------------- Comment By: Fabio Parodi (fabioparodi) Date: 2008-03-06 04:19 Message: Logged In: YES user_id=1762228 Originator: NO It looks like the sys module is the same prior and after the dialog. Only that frozen and stdout have been modified. See log below. C:\Documents and Settings\parodi\Desktop>filedialog.py sys is <module 'sys' (built-in)> attribute api_version is 1013 attribute executable is C:\Python25\python.exe attribute hexversion is 33882864 attribute path is ['C:\\Documents and Settings\\parodi\\Desktop', 'C:\\WINDOWS\\ system32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python2 5\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\l ib\\site-packages', 'C:\\Python25\\lib\\site-packages\\PIL', 'C:\\Python25\\lib\ \site-packages\\pythonutils', 'C:\\Python25\\lib\\site-packages\\win32', 'C:\\Py thon25\\lib\\site-packages\\win32\\lib', 'C:\\Python25\\lib\\site-packages\\Pyth onwin', 'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode'] attribute version is 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bi t (Intel)] attribute version_info is (2, 5, 2, 'final', 0) Redirecting output to win32trace remote collector sys.stdout has been redirected sys.frozen = dll sys is <module 'sys' (built-in)> attribute api_version is 1013 attribute executable is C:\Python25\python.exe attribute hexversion is 33882864 attribute path is ['C:\\Documents and Settings\\parodi\\Desktop', 'C:\\WINDOWS\\ system32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python2 5\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\l ib\\site-packages', 'C:\\Python25\\lib\\site-packages\\PIL', 'C:\\Python25\\lib\ \site-packages\\pythonutils', 'C:\\Python25\\lib\\site-packages\\win32', 'C:\\Py thon25\\lib\\site-packages\\win32\\lib', 'C:\\Python25\\lib\\site-packages\\Pyth onwin', 'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\Programmi\\ TortoiseHg\\library.zip'] attribute version is 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bi t (Intel)] attribute version_info is (2, 5, 2, 'final', 0) C:\Documents and Settings\parodi\Desktop> ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-03-06 03:44 Message: Logged In: YES user_id=411637 Originator: NO I wonder which sys module the script has picked up. Is there a way to retrieve that info and print it out in your script, with and without tortoisehg installed? I really appreciate your help and patience on this issue. ---------------------------------------------------------------------- Comment By: Fabio Parodi (fabioparodi) Date: 2008-03-06 03:21 Message: Logged In: YES user_id=1762228 Originator: NO I have Python 2.5.1 and pywin32-210 (don’t know the minor version). When I uninstall TortoiseHG I do not get the error and sys.frozen does not exist anymore. Then I install python 2.5.2, pywin32-210-5, TortoiseHG 0.3, I get the error. I run the following program from cmdline: def runWindows(): import win32gui, win32con fname, customfilter, flags=win32gui.GetSaveFileNameW( Flags=win32con.OFN_EXPLORER, DefExt='py', Filter="", CustomFilter="", FilterIndex=1) runWindows() if sys.stdout != fout: print>>fout, 'sys.stdout has been redirected' if hasattr(sys, 'frozen'): print>>fout, 'sys.frozen =', sys.frozen else: print>>fout, 'sys has not attribute "frozen"' I get the following output: C:\Documents and Settings\parodi\Desktop>filedialog.py Redirecting output to win32trace remote collector sys.stdout has been redirected sys.frozen = dll ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-03-05 21:23 Message: Logged In: YES user_id=411637 Originator: NO Do you still get the error and and sys.frozen if you uninstall TortoiseHg? BTW, what version/flavor of python & pythonwin are you using? Do you have capacity to install TortoiseHg from source? It might help us debug the issue later. You might need the dev version of pythonwin (for python 2.5) for this: http://starship.python.net/crew/mhammond/downloads/pywin32-210.5.win32-py2.5.exe ---------------------------------------------------------------------- Comment By: Fabio Parodi (fabioparodi) Date: 2008-03-05 20:50 Message: Logged In: YES user_id=1762228 Originator: NO I tried to run filedialog.py on my PC. It prints an error message and then show the file dialog. C:\Documents and Settings\parodi\Desktop>filedialog.py Traceback (most recent call last): File "boot_com_servers.py", line 21, in <module> File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in <module> pywintypes.__import_pywin32_system_module__("pythoncom", globals()) File "C:\Python25\lib\site-packages\win32\lib\pywintypes.py", line 98, in __im port_pywin32_system_module__ ('.dll', 'rb', imp.C_EXTENSION)) ImportError: DLL load failed: Impossibile trovare la procedura specificata. Note that the file dialog is shown correctly after the error. Then I changed the filedialog.py, added the following lines at the bottom: if hasattr(sys, 'frozen'): print 'sys.frozen =', sys.frozen else: print 'sys has not attribute "frozen"' I get the following output: C:\Documents and Settings\parodi\Desktop>filedialog.py Traceback (most recent call last): File "boot_com_servers.py", line 21, in <module> File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in <module> pywintypes.__import_pywin32_system_module__("pythoncom", globals()) File "C:\Python25\lib\site-packages\win32\lib\pywintypes.py", line 98, in __im port_pywin32_system_module__ ('.dll', 'rb', imp.C_EXTENSION)) ImportError: DLL load failed: Impossibile trovare la procedura specificata. sys.frozen = dll This is wrong, as I am running the script from command line, sys should not have the frozen attribute. Fabio ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-03-05 20:18 Message: Logged In: YES user_id=411637 Originator: NO nobody: Just to confirm my doubt. Can you run the attached filedialog.py to see if you get a working file dialog? Thanks. File Added: filedialog.py ---------------------------------------------------------------------- Comment By: Steve Borho (sborho) Date: 2008-03-05 10:18 Message: Logged In: YES user_id=12062 Originator: NO TortoiseHg doesn't set the sys.frozen attribute, the py2exe packaged DLLs do that internally. The problem you have is that those applications are picking up the TortoiseHG DLLs before their own. Any py2exe packages python application would cause the same behavior. To fix this, all of TortoiseHg's DLLs should probably get moved into a subdirectory so that they don't sit directly in the system PATH, but I suspect it won't be an easy change to make. Nor do I have the time to even try it. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-03-05 07:44 Message: Logged In: NO You can find pythonutils at http://www.voidspace.org.uk/python/pythonutils.html/ There is a function in file pathutils.py: def main_is_frozen(): """Return ``True`` if we're running from a frozen program.""" import imp return ( # new py2exe hasattr(sys, "frozen") or # tools/freeze imp.is_frozen("__main__")) Normally if you run a program from the debugger, sys do not have the attribute "frozen". If you run an executable built with py2exe, then sys has the attribute "frozen". This is useful to distinguish whether you are running from the development environment or from the exe file. If you install TortoiseHG and your program uses wx.FileDialog, then you will find the attibute "frozen" in sys. My speculation: TortoiseHG sets sys.frozen because it is processed by py2exe. Also sys.stdout is dirty. I do not know what else is dirty. It would be better to separate the process spaces totally. ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-03-04 10:20 Message: Logged In: YES user_id=411637 Originator: NO That's not very good :-( Where can I find pythonutils.pathutils? ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-03-01 10:15 Message: Logged In: NO Yes I install mercurialhg 0.3 with the binary installer for windows, and the problem is still there, at least on my PC. There is also a problem with pythonutils.pathutils.get_main_dir(). The issue is that two python programs are sharing the same process space. ---------------------------------------------------------------------- Comment By: TK Soh (tksoh) Date: 2008-02-29 19:48 Message: Logged In: YES user_id=411637 Originator: NO This is caused by an issue in pythonwin, and has been fixed in pythonwin's CVS tree: http://mail.python.org/pipermail/python-win32/2008-January/006698.html Did you install TortoiseHg via the 0.3 binary installer? The 0.3 installer is already linked to the version of pythonwin (210.5) that contains the fix. Please let us known if it doesn't. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=968354&aid=1904798&group_id=199155 ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Tortoisehg-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop
