0

i was able to create a standalone python dash app on mac OS and it runs perfectly with cx_Freeze however when i repeat the process on widows it gives me an error during runtime: “AttributeError: ‘NoneType’ object has no attribute write”, is there any way to solve this issue or another way of freezing the application? i have tried py2exe and PyInstaller with no luck, any help would be appreciated, thanks in advance.

below are the images of the program running on mac with the output:

mac working program

and the same program with an error on windows.

windows error image

i used the command python setup.py build in CMD and Terminal below attached is the setup file written in python, the program is too large to post here but if any part of it needed i can provide

from cx_Freeze import setup, Executable
import sys

buildOptions = dict(
    packages=["dash_core_components", "dash_html_components", "dash.dependencies", "dash", "dash_table", "flask",
              "numpy", "pandas", "plotly.figure_factory", "plotly.express", "jinja2", "sys", "_datetime", "io",
              "plotly.graph_objects", "xlrd", "plotly"],
    excludes=[],
    include_files=["Test.xlsx/"]
)

base = 'Win32GUI' if sys.platform == 'win32' else None

executables = Executable(script='FISE MGMT App.py',
                         base=base,
                         icon='icon.ico'
                         )

setup(name='hadi',
      version='1.0',
      description='my app',
      options=dict(build_exe=buildOptions),
      executables=[executables])

EDIT: so i figured out that the issue was because my base was set to Win32GUI instead of none when using windows, although that works, I would like a way where the CMD does not open on startup is there a way to do that without getting that ‘write’ attribute error?

icedwater
  • 4,701
  • 3
  • 35
  • 50
Hadi Baba
  • 1
  • 2
  • Welcome to SO. Could you describe your issue in more detail, please? E.g. by adding code, commands or screen shots which describe your problem. Please have also a look to the Help Center, especially for [asking](https://stackoverflow.com/help/how-to-ask) and [minimal examples](https://stackoverflow.com/help/mcve). Thanks. – CKE Nov 10 '19 at 07:08

1 Answers1

0

I faced the same issue couple of days ago and finally fixed. I have posted the answer here: https://stackoverflow.com/a/63964910/14300057

Manoj K
  • 21
  • 4