UmSenhorQualquer / pyforms

Python layer of Windows forms, based on PyQt and OpenGL
MIT License
648 stars 68 forks source link

Create an exe with cx_freeze #91

Open jasonbillebault opened 5 years ago

jasonbillebault commented 5 years ago

Hello,

I'm trying to create an executable with CX_Freeze.

When I declare packages with pyforms_gui I've got an error.

packages = ["idna","pyforms","pyforms_gui"]

_D:\OneDrive\OneDrive - Q-Matic AB\00_Python\bin\devGUI>python setup2.py build
running build
running build_exe
Traceback (most recent call last):
  File "setup2.py", line 23, in <module>
    executables = executables
  File "D:\Python\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
    distutils.core.setup(**attrs)
  File "D:\Python\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "D:\Python\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "D:\Python\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "D:\Python\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "D:\Python\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Python\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "D:\Python\lib\site-packages\cx_Freeze\dist.py", line 219, in run
    freezer.Freeze()
  File "D:\Python\lib\site-packages\cx_Freeze\freezer.py", line 624, in Freeze
    self.finder = self._GetModuleFinder()
  File "D:\Python\lib\site-packages\cx_Freeze\freezer.py", line 347, in _GetModuleFinder
    finder.IncludePackage(name)
  File "D:\Python\lib\site-packages\cx_Freeze\finder.py", line 661, in IncludePackage
    self._ImportAllSubModules(module, deferredImports)
  File "D:\Python\lib\site-packages\cx_Freeze\finder.py", line 288, in _ImportAllSubModules
    recursive)
  File "D:\Python\lib\site-packages\cx_Freeze\finder.py", line 283, in _ImportAllSubModules
    raise ImportError("No module named %r" % subModuleName)
ImportError: No module named 'pyforms_gui.utils.BioradWriter'_

What is utils.BioradWriter? How could I import it?

Regards, Jason.

jasonbillebault commented 5 years ago

Hello,

I tried to compile the BioradWriter.py because I can see that this file isn't generated in pycache folder,

image

image

Unfortunately, i have an error when trying to compile it

  File "D:\Python\Lib\site-packages\pyforms_gui\utils\BioradWriter.py", line 37
    except (IOError) as e:
                         ^
TabError: inconsistent use of tabs and spaces in indentation
[Finished in 0.1s with exit code 1]

Please could you do something about it?

jasonbillebault commented 5 years ago

In fact, it was easy. You have an identation issue with the try and the except commands.

    try:
        with open(BioradWriter.imageJDir + BioradWriter.bioradWriterConfigFile, 'w') as f:
            f.write(os.getcwd() + "/output/\n");
            f.write(outputFileName);        
    except (IOError) as e:
        raise e