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
EncodingWarnings raised (3) when using pyfakefs #957
Yes, that's right (confirmed in pypa/distutils@38b58a5b). I thought it might be something like that. I was unsure because the warning only gives the one location. I wonder if it's possible to alter the stacklevel or otherwise manipulate the warning in the __init__ wrapper, but I can't think of a way to do it. I also asked Gemini, and it also couldn't devise a general solution.
I guess one solution could be to capture the warning in the init wrapper and then emit a new warning. Not sure it's worth it except to improve the discoverability for other users.
I guess one solution could be to capture the warning in the init wrapper and then emit a new warning
Well, that would be a possibility, but I'm reluctant to go that way. It would make the code more complicated for a questionable improvement.
Out of curiosity, how did you track it down?
That was easy - the warning message says where it comes from, and I just checked the respective code in disutils.
Oh, and I also made sure to get the same warning in the real fs.
That was easy - the warning message says where it comes from, and I just checked the respective code in disutils. Oh, and I also made sure to get the same warning in the real fs.
Oh! True. The output does mention the test that was being run. I didn't investigate it because I knew that in general the warning could have been triggered anywhere within that test (as part of setup/teardown or deep in the exercised behavior), but as it turns out, it was right there, so that makes sense.
Agreed, probably not worth the hassle to try to surface those - but you may decide to revisit when these warnings surface for all users and not just those opting into the warnings early.
I don't need a patch release. More important will be to have a notice here when the release is made so I can know to remove the warning exclusion.
Activity
Suppress EncodingWarnings in pyfakefs. Ref #232. Workaround for pytes…
Suppress EncodingWarnings in pyfakefs. Ref #232. Workaround for pytes…
mrbean-bremen commentedon Mar 3, 2024
The first 2 warnings are trivial to fix, but as far as I can see, the third warning:
comes from the client code:
write_textmisses theencodingargument.@jaraco - can you confirm this?
jaraco commentedon Mar 3, 2024
Yes, that's right (confirmed in pypa/distutils@38b58a5b). I thought it might be something like that. I was unsure because the warning only gives the one location. I wonder if it's possible to alter the stacklevel or otherwise manipulate the warning in the
__init__wrapper, but I can't think of a way to do it. I also asked Gemini, and it also couldn't devise a general solution.I guess one solution could be to capture the warning in the init wrapper and then emit a new warning. Not sure it's worth it except to improve the discoverability for other users.
Out of curiosity, how did you track it down?
mrbean-bremen commentedon Mar 3, 2024
Thanks for the fast response!
Well, that would be a possibility, but I'm reluctant to go that way. It would make the code more complicated for a questionable improvement.
That was easy - the warning message says where it comes from, and I just checked the respective code in
disutils.Oh, and I also made sure to get the same warning in the real fs.
Use locale.getencoding instead of getpreferredencoding
Use locale.getencoding instead of getpreferredencoding
Use locale.getencoding instead of getpreferredencoding
mrbean-bremen commentedon Mar 3, 2024
Should be fixed in main now. Do you need a patch release?
jaraco commentedon Mar 3, 2024
Oh! True. The output does mention the test that was being run. I didn't investigate it because I knew that in general the warning could have been triggered anywhere within that test (as part of setup/teardown or deep in the exercised behavior), but as it turns out, it was right there, so that makes sense.
Agreed, probably not worth the hassle to try to surface those - but you may decide to revisit when these warnings surface for all users and not just those opting into the warnings early.
I don't need a patch release. More important will be to have a notice here when the release is made so I can know to remove the warning exclusion.
mrbean-bremen commentedon Mar 3, 2024
Sure, if this pops up again, I will remember that ;)
Sure, I'll let you know.
mrbean-bremen commentedon Apr 7, 2024
FYI: A new release is out.
Revert "Suppress EncodingWarnings in pyfakefs. Ref #232. Workaround for
pypi-setuptools: Autospec creation for update from version 69.2.0 to …