0

I have a python program that uses the Graphiz module, the output of the program uses the Graphviz windows installation to create an image. My program is for average windows users and my goal is to deliver one msi installer. I don't have issues using the cx_Freeze to pack my python modules and run the outcome afterwards... The problem is, the program depends on the installed Graphviz dir to create the image from my programs output moreover the dir's bin folder should be in the system path....

If there is a solution using cx_Freeze (and I tried and didn't find one) pls help me If not pls advice how can I circumvent this problem

Thanks a million!

import sys, os
from cx_Freeze import setup, Executable

build_exe_options = {"packages": ["PIL.Image",
                                  "tkinter",
                                  "graphviz",
                                  "Rec_FFT",
                                  "graph_visualization",
                                  "math",
                                  "cmath"],
                     "include_files": [
                         r"D:\Yigal\Python36-32\DLLs\tcl86t.dll",
                         r"D:\Yigal\Python36-32\DLLs\tk86t.dll"],
                     }

base = None
if sys.platform == "win32":
    base = "Win32GUI"
    # pass # base=None is for console apps

os.environ['TCL_LIBRARY'] = r'D:\Yigal\Python36-32\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'D:\Yigal\Python36-32\tcl\tk8.6'

setup(name="FFTCalc",
      version="0.1",
      description="# Rec FFT Calc #",
      options={
          "build_exe": build_exe_options
      },
      executables=[Executable("Rec_FFT_GUI.py", base=base)])

This is the output when Graphiz is not installed:

graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tjpeg', '-O', 'FFT_RESULTS\\graph'], make sure the Graphviz executables are on your systems' PATH

I can see it is missing the dot.exe ... but how can I pack it with cx_Freeze??

YigalO
  • 1
  • 1
  • Are you including Graphviz in your setup file – Joe Sep 14 '17 at 13:28
  • as a module?... yes, I don't know how to include the Graphviz installation folder.. – YigalO Sep 14 '17 at 13:29
  • Look at this link. It is a similar answer I provided to help create these files. Let me know if it helps https://stackoverflow.com/questions/43568915/import-tkinter-if-this-fails-your-python-may-not-be-configured-for-tk/44556851#44556851 – Joe Sep 14 '17 at 13:32
  • I actually used this answer for the tkinter part...so thanks for that!! – YigalO Sep 14 '17 at 13:37
  • If it helps will you upvote? and does it not help with the Graph? – Joe Sep 14 '17 at 13:37
  • I did use your answer for the tkinter part...thanks for that!! I just don't know how to find this dependencies... – YigalO Sep 14 '17 at 13:44
  • You need to find the path where it is installed – Joe Sep 14 '17 at 13:52
  • I know the path...I installed it, but how can I pack this dependency with cx_Freeze, how can I tell the setup script that when my graphviz module is using the rendering method that it should look for dot.exe(and all the other files it needs for that matter) in a specified place that ships with the cx_freeze executable and is independent... – YigalO Sep 14 '17 at 14:04
  • I think I am not sure what you are asking. You could try putting everything in one directory and pointing the setup file at that. It should be in the include statement, if there I don't see why it wouldn't include it – Joe Sep 14 '17 at 14:05
  • use py2exe it will not create more files and do your work within single line command – babygame0ver Sep 14 '17 at 14:20
  • Some one?, pls!!!! The problem is not using cx_Freeze but how the setup should look like.... My only problem is how to make one nice standalone msi installer that will include an exe for my python program and also will install and configure another msi installer (specifically Graphviz). I am open to any tutorials or ideas/approaches<<<<<<---------------------------------------------- – YigalO Sep 16 '17 at 16:05

0 Answers0