Search code examples
pythondatabasewindowsautomationfoxpro

Foxpro database Python automation error message


I have a stocks database program written in Foxpro some of whose actions I am trying to automate in Python through the pyautoit package. I can successfully run the program and access its database by double clicking its exe file), but when I try to start the program via Python:

import autoit as au
au.run(r'C:\Program Files (x86)\...\stocks.exe')

I get the following message:

Windows error message

I am running Windows 7 professional, and the only 'Foxtools' file I can find in the program's folder is a foxtools.fll file.


Solution

  • I have managed to solve this issue. Just as @Tamar E. Granor said, it is a path issue. The pyautoit module provides an optional path parameter for the working directory which by default is set to be that of the Python file. Changing that WD to the Foxpro file directory resolves the conflict:

    import autoit as au
    au.run('C:\Program Files (x86)\...\stocks.exe',
           'C:\Program Files (x86)\...\[WD]')