Re: [python-win32] win32api.FindFiles hangs (was COM registration hangs up: 32 bit Python 3.7 on 64 bit Win 7)
Yes, the directory is a net share. On a local hard drive I do not experience this problem. If I ask for *.py I get a list back that includes the file. If I ask for "BSTI*" I get back a list of 1 element, the file. But if I ask for "BSTImport.py" it hangs. My experiments with Dir$() in Visual Basic , reported earlier, strongly suggest the problem is that Windows FindNextFile function simply keeps returning the file name forever. I've reported this to the people running the server, though it certainly could be a problem on my local machine. I code in C, but don't have a development environment handy. Hence the test in VBA. Ross From: python-win32 on behalf of Tim Roberts Sent: Wednesday, December 5, 2018 2:21:33 PM To: python-win32@python.org Subject: Re: [python-win32] win32api.FindFiles hangs (was COM registration hangs up: 32 bit Python 3.7 on 64 bit Win 7) Boylan, Ross wrote: > > Is this some kind of string conversion issue? My installation is borked? > Manual debugging statements show sys.argv[0] is 'BSTImport.py'. > > win32api.FindFiles('BSTImport.py') > in a python 3.7 shell (32 bit) hangs. That's quite bizarre. The code for win32api.FindFiles is straightforward. Is this a special directory, like a net share or something? If you ask for *.py, is BSTImport.py in the list you get back? Do you code in C? You might code up a trivial C app to run a FindFirstFile/FindNextFile loop with the same parameters to see if the same thing happens. Of course, I'm not sure what the next step would be, whether that worked or failed. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32 ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] win32api.FindFiles hangs
The problem doesn't seem to be python-specific; it appears the underlying FindNext function in the Windows API just keeps returning the same file name instead of moving on. In VBA in Access 2010: Public Sub test2(pattern) Dim fn As String fn = Dir$(pattern) Do While fn <> "" Debug.Print fn fn = Dir$() Loop End Sub When I execute with test2("Z:BSTImport.py") this loops, apparently forever, with each iteration returning BSTImport.py. If I give it *.py as the pattern it prints 2 files (correctly) and exits. I assume the first call to Dir$ does FindFirst and the later ones do FindNext. Using the complete path name doesn't help. This seems both bizarre and a sign that my installation of Windows (not python for windows) is pretty messed up. Ross From: python-win32 on behalf of ckk...@hoc.net Sent: Wednesday, December 5, 2018 6:48:21 AM To: python-win32@python.org Subject: Re: [python-win32] win32api.FindFiles hangs Works just fine on my windows7 machine with python2.7 64bit and pywin32-221 It yields results for both existing and non existing files. Christian Am 2018-12-05 01:20, schrieb ross.boy...@ucsf.edu: > win32api.FindFiles() works when the argument is "*" or "*.py". It > works, in the sense of returning an empty list, if the argument is a > random name not present in the directory. But it fails with > "BSTImport.py", as well as the name of every file in the directory > that I've tried. > > From: Boylan, Ross > Sent: Tuesday, December 4, 2018 5:12 PM > To: python-win32@python.org > Subject: win32api.FindFiles hangs (was COM registration hangs up: 32 > bit Python 3.7 on 64 bit Win 7) > > I tried using my 64 bit Python 3.6 and ran into the same problem. > Tracing through with pdb, the following line seems to be where it hung > up: >> c:\program >> files\python36\lib\site-packages\win32com\server\register.py(419)RegisterClasses() > -> moduleName = > os.path.splitext(win32api.FindFiles(sys.argv[0])[0][8])[0] > (Pdb) n > > Is this some kind of string conversion issue? My installation is > borked? > Manual debugging statements show sys.argv[0] is 'BSTImport.py'. > > win32api.FindFiles('BSTImport.py') > in a python 3.7 shell (32 bit) hangs. > > I think I installed pywin32 via pip. > ___ > python-win32 mailing list > python-win32@python.org > https://mail.python.org/mailman/listinfo/python-win32 ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32 ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] win32api.FindFiles hangs (was COM registration hangs up: 32 bit Python 3.7 on 64 bit Win 7)
Boylan, Ross wrote: Is this some kind of string conversion issue? My installation is borked? Manual debugging statements show sys.argv[0] is 'BSTImport.py'. win32api.FindFiles('BSTImport.py') in a python 3.7 shell (32 bit) hangs. That's quite bizarre. The code for win32api.FindFiles is straightforward. Is this a special directory, like a net share or something? If you ask for *.py, is BSTImport.py in the list you get back? Do you code in C? You might code up a trivial C app to run a FindFirstFile/FindNextFile loop with the same parameters to see if the same thing happens. Of course, I'm not sure what the next step would be, whether that worked or failed. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] win32api.FindFiles hangs
Works just fine on my windows7 machine with python2.7 64bit and pywin32-221 It yields results for both existing and non existing files. Christian Am 2018-12-05 01:20, schrieb ross.boy...@ucsf.edu: win32api.FindFiles() works when the argument is "*" or "*.py". It works, in the sense of returning an empty list, if the argument is a random name not present in the directory. But it fails with "BSTImport.py", as well as the name of every file in the directory that I've tried. From: Boylan, Ross Sent: Tuesday, December 4, 2018 5:12 PM To: python-win32@python.org Subject: win32api.FindFiles hangs (was COM registration hangs up: 32 bit Python 3.7 on 64 bit Win 7) I tried using my 64 bit Python 3.6 and ran into the same problem. Tracing through with pdb, the following line seems to be where it hung up: c:\program files\python36\lib\site-packages\win32com\server\register.py(419)RegisterClasses() -> moduleName = os.path.splitext(win32api.FindFiles(sys.argv[0])[0][8])[0] (Pdb) n Is this some kind of string conversion issue? My installation is borked? Manual debugging statements show sys.argv[0] is 'BSTImport.py'. win32api.FindFiles('BSTImport.py') in a python 3.7 shell (32 bit) hangs. I think I installed pywin32 via pip. ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32 ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32