[issue40885] Cannot pipe GzipFile into subprocess

2021-10-22 Thread Michael Herrmann


Michael Herrmann  added the comment:

I just encountered what seems to be the inverse problem of this issue: #45585

--
nosy: +mherrmann.at

___
Python tracker 
<https://bugs.python.org/issue40885>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45585] Gzipping subprocess output produces invalid .gz file

2021-10-22 Thread Michael Herrmann


New submission from Michael Herrmann :

Consider the following:

import gzip
import subprocess

with gzip.open('test.gz', 'wb') as f:
subprocess.run(['echo', 'hi'], stdout=f)

with gzip.open('test.gz', 'rb') as f:
print(f.read())

I'd expect "hi" to appear in my console. Instead, I'm getting "OSError: Not a 
gzipped file (b'hi')". I am attaching test.gz.

This appears for me on Debian 10 / Python 3.7 and Debian 11 / Python 3.9. I 
have not yet tested on other OSs and Python versions.

The reason why I expect the above to work is that the subprocess documentation 
states that the stdout parameter may be "an existing file object" and that on 
the other hand the documentation for gzip.open(...) states that it returns a 
file object.

Maybe this is related to #40885?

--
files: test.gz
messages: 404853
nosy: mherrmann.at
priority: normal
severity: normal
status: open
title: Gzipping subprocess output produces invalid .gz file
type: behavior
versions: Python 3.7, Python 3.9
Added file: https://bugs.python.org/file50391/test.gz

___
Python tracker 
<https://bugs.python.org/issue45585>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19046] SystemError: ..\Objects\weakrefobject.c:903: bad argument to internal function

2013-09-19 Thread Michael Herrmann

New submission from Michael Herrmann:

I'm on 32 bit Python 2.7.3 and 64 bit Windows 7. I am working on a complex, 
multithreaded application which uses COM to communicate with other processes.

My application uses regular expressions in a few (but not very many) places. An 
example re I am trying to match is 'quit(\\(.*\\))?', an example input would be 
'quit()'. Nothing exciting.

Very frustratingly, even though the regular expressions and inputs are the 
same, I spuriously get errors of the following form:

Traceback (most recent call last):
  ...
  File "re.pyc", line 137, in match
SystemError: ..\Objects\weakrefobject.c:903: bad argument to internal function

I have seen the bug many times on 2.7.3. I briefly tried to reproduce it on 
2.7.5 and it did not occur. This may be because the bug only occurs spuriously 
and I was unlucky, or because the bug no longer exists in 2.7.5. My 
(unverified) hunch is that the bug is not in 2.7.5 anymore. 

I have a C unhandled exception handler installed in my application. What's 
interesting is that the bug frequently seems to occur together with an 
unhandled memory access violation (exception code C005). When this is the 
case, the Python interpreter hangs or crashes.

I have not seen similar crashes in my application at other points; only when 
working with regular expressions and seeing the above stack trace.

--
components: Regular Expressions, Windows
messages: 198045
nosy: ezio.melotti, mherrmann.at, mrabarnett
priority: normal
severity: normal
status: open
title: SystemError: ..\Objects\weakrefobject.c:903: bad argument to internal 
function
type: crash
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue19046>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2128] sys.argv is wrong for unicode strings

2013-01-13 Thread Michael Herrmann

Michael Herrmann added the comment:

Hi,

is it correct that this bug no longer appears in Python 2.7.3? I checked the 
changelogs of 2.7, but couldn't find anything.

Thanks!
Michael

--
nosy: +mherrmann.at

___
Python tracker 
<http://bugs.python.org/issue2128>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-14 Thread Michael Herrmann

Michael Herrmann  added the comment:

That is *exactly* my point :)

--

___
Python tracker 
<http://bugs.python.org/issue12982>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread Michael Herrmann

Michael Herrmann  added the comment:

Dear Eric OL,

I see - I had read your e-mail but because of the similar names I thought the 
message here was yours too, and thus only replied once. I apologize!

I can of course find a workaround such as renaming .pyo to .pyc. However, I 
would like to avoid having to modify the distribution of the third party 
library I am using in any way. The reason is that if a new version of this 
third party library is released and I have to upgrade to this new version, I 
will again have to manually do all the changes I had to do for the old version 
for the new version, and of course some changes won't work any more and there 
will be problems...

I'm finding it tedious to use the imp-module to read in the .pyo-files by hand 
and might just fall back to your suggestion. Thank you for it. Nevertheless, I 
am still hoping that this may be resolved in a future release.

Best,
Michael

--

___
Python tracker 
<http://bugs.python.org/issue12982>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread Michael Herrmann

Michael Herrmann  added the comment:

Hi Eric,

thank you for your quick reply. I'm not the first one who encounters this 
problem and in my opinion it is simply counter-intuitive that you cannot read a 
mixture of .pyo and .pyc files. That is why I think that my proposed change is 
valuable. In the meantime, I will follow your suggestion and try to use the 
imp-module to load the .pyo-files myself. Thank you!

Best regards,
Michael

--

___
Python tracker 
<http://bugs.python.org/issue12982>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] .pyo file can't be imported unless -O is given

2012-06-12 Thread Michael Herrmann

Michael Herrmann  added the comment:

Hi,

I need to use a third-party library that ships as a mixture of .pyc and .pyo 
files. I found it a little surprising and inconvenient that I have to set the 
-O flag just to read .pyo files. I don't mind whether .pyc or .pyo files are 
being created during compilation, I just want to be able to read from both .pyc 
and .pyo files without having to use the -O flag. Can somebody fix this? I 
unfortunately have absolutely no clue how.

Thanks!

--
components: +Interpreter Core -Documentation
nosy: +mherrmann.at

___
Python tracker 
<http://bugs.python.org/issue12982>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com