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 <[email protected]> on
behalf of [email protected] <[email protected]>
Sent: Wednesday, December 5, 2018 6:48:21 AM
To: [email protected]
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 [email protected]:
> 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: [email protected]
> 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
> [email protected]
> https://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32