Skip to content

2.0.0 sys.stderr attribute error packaged with cx_freeze #26862

@jonnypeace

Description

@jonnypeace

Describe the issue:

I have tested by only upgrading to 2.0.0 with numpy, and noticed the package build with cx freeze would be successful, until I tried to open the executable, and I would receive this window pop up.

Version 1.26.4 would package fine with cx_freeze and I've not upgrade cx_freeze.

If I have more time at the end of my day I will trek through some of the files and see if sys.stderr is modified anywhere in your code.

Sorry for the short code block below, it happens on launch.

Reproduce the code example:

import numpy as np

Error message:

cx_Freeze: Python error in main script

Traceback (most recent call last):
  File "CENSORED/lib/site-packages/cx_Freeze/initscripts/__startup__.py", line 141, in run
    module.run(name + "__main__")
  File "CENSORED/lib/site-packages/cx_Freeze/initscripts/Console.py", line 25, in run
    exec(code, __main__.__dict__)
  File "output_data.py", line 2, in <module>
  File "CENSORED/reproducibility.py", line 6, in <module>
    from .interpolate import PchipInterpolator
  File "CENSORED/interpolate/__init__.py", line 167, in <module>
  File "CENSORED/interpolate/interpolate.py", line 10, in <module>
    import scipy.special as spec
  File "CENSORED/special/__init__.py", line 811, in <module>
  File "CENSORED/special/_ufuncs.py", line 7, in <module>
  File "CENSORED/_lib/_uarray/_uarray_dispatch.cpython-38-x86_64-linux-gnu.so", line 21, in init _lib._uarray
  File "CENSORED/__init__.py", line 19, in <module>
    from . import _typeconv
  File "CENSORED/_typeconv.py", line 23, in <module>
    from . import _nd_image
  File "CENSORED/_nd_image.py", line 159, in <module>
    from . import _ni_support
  File "CENSORED/_ni_support.py", line 19, in <module>
    from . import _numpy_compat
  File "CENSORED/_numpy_compat.py", line 19, in <module>
    from . import _pocketfft_internal
  File "CENSORED/_pocketfft_internal.py", line 19, in <module>
    from . import _spectral
  File "CENSORED/_spectral.py", line 19, in <module>
    errmess = sys.stderr.write
AttributeError: 'NoneType' object has no attribute 'write'

Python and NumPy Versions:

2.0.0

Runtime Environment:

Using a package build with cx freeze, on windows 10. Cx freeze is version 7.1.1

Context for the issue:

I can use 1.26.4, I just noticed this bug during a package build using 2.0.0. I realise 2.0.0 is a major release, and if stderr is potentially a None on import, then it might be worth looking at.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions