Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an exe with cx_freeze #91

Open
jasonbillebault opened this issue Mar 13, 2019 · 2 comments
Open

Create an exe with cx_freeze #91

jasonbillebault opened this issue Mar 13, 2019 · 2 comments

Comments

@jasonbillebault
Copy link

jasonbillebault commented Mar 13, 2019

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
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant