You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
2.0.0 sys.stderr attribute error packaged with cx_freeze #26862
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:
importnumpyasnp
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.
I really don't see anything here related to NumPy (numpy isn't in the stacktrace, numpy has nothing to do with sys.stderr, ...). If it really has to do with the NumPy version as you say, I half expect that installing/uninstalling it just changed other versions as well.
Going to close this for now, if you can get a better idea of why NumPy is involved, please post and we can reopen.
I did have time to check the previous version, which had a utils.py, which reassigned sys.stderr, but in 2.0.0, that file doesn't seem to exist... I think. I will have a look further when I get time, thanks for getting back.
Activity
seberg commentedon Jul 6, 2024
I really don't see anything here related to NumPy (numpy isn't in the stacktrace, numpy has nothing to do with
sys.stderr, ...). If it really has to do with the NumPy version as you say, I half expect that installing/uninstalling it just changed other versions as well.Going to close this for now, if you can get a better idea of why NumPy is involved, please post and we can reopen.
jonnypeace commentedon Jul 6, 2024
I did have time to check the previous version, which had a utils.py, which reassigned sys.stderr, but in 2.0.0, that file doesn't seem to exist... I think. I will have a look further when I get time, thanks for getting back.
nicoddemus commentedon Jul 22, 2024
Hi folks,
I'm seeing the same problem, here is the traceback I'm getting:
Here is the line that crashes:
numpy/numpy/f2py/cfuncs.py
Line 19 in b3feb3c
When frozen without a console (common in GUI applications),
sys.stderrandsys.stdoutare bothNone.I'm seeing this crash both in
2.0.0and2.0.1.cfuncs.py: fix crash when sys.stderr is not available
cfuncs.py: fix crash when sys.stderr is not available
cfuncs.py: fix crash when sys.stderr is not available