0

I have a GUI script, called ui.py, created in PySide that uses functions from another script, called DataFunctions.py. When I run the ui.py file in python it all works perfectly, and when I run the ui.exe file it will all work fine apart from the button that runs the DataFunctions.py file, which does nothing. In my ui.py file I am importing DataFunctions.py with:

import DataFunctions.py

buttonAction = DataFunctions.writeFile(filename, data)

I am using the following code to create the .exe:

pyinstaller ui.py -w -F

Am I importing the DataFunctions.py file in a way that pyinstaller doesn't support?

adam b
  • 346
  • 1
  • 7
  • 17

2 Answers2

2
  1. Drop the .py extension in the import line

      import Datafunctions
    
  2. Make sure the Datafunctions.py code is in the same folder.

philshem
  • 24,761
  • 8
  • 61
  • 127
  • It still doesn't seem to help anything. I have tried to explicitly select the with -p – adam b Apr 22 '15 at 21:07
  • Maybe a good case to [import from an absolute path](http://stackoverflow.com/a/67692/2327328) – philshem Apr 22 '15 at 21:08
  • Thanks for the suggestion, but it still hasn't worked. I'm beginning to think it might be a problem with pyinstaller itself. – adam b Apr 22 '15 at 21:42
0

It turns out that the DataFunctions.py file was included in the .exe, however some file paths relative to the DataFunctions.py file inside it were not set correctly due to the .exe being created in another folder. If anyone else is having similar problems, make sure you don't specify -w so that you can use the console to debug your .exe. Look here for how to find the location of the .exe file when it is run.

Community
  • 1
  • 1
adam b
  • 346
  • 1
  • 7
  • 17