Redux error: "can't write str to text stream"
Added by Steve Wilson over 10 years ago
I found three other similar issues on the forum but no real solution that I could tell. When using redux with its cache enabled ("redux --server_host=localhost --filename=/root/test.jpg --oformat=PNG > test.png"), I get the following error in the redux log:
REQUEST: server_host=localhost&oformat=PNG&filename=/root/test.jpg NOT IN MEMORY: Format(28901904,oformat=PNG,overlay=,overlaycolor=0.1,rgb=False) NOT IN MEMORY: Read(28901840,filename=/root/test.jpg,info=False) Running Read(28901840,filename=/root/test.jpg,info=False) Running Format(28901904,oformat=PNG,overlay=,overlaycolor=0.1,rgb=False) 1407939689.31 Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/redux/server.py", line 39, in run_process result = pipeline.process(**kwargs) File "/usr/lib/python2.6/site-packages/redux/pipeline.py", line 147, in process results.put(done, result) File "/usr/lib/python2.6/site-packages/redux/cache.py", line 40, in put return self._put(pipeline, result) File "/usr/lib/python2.6/site-packages/redux/cache.py", line 35, in _put self.file_put(pipeline, result) File "/usr/lib/python2.6/site-packages/redux/cache.py", line 82, in file_put final_pipe.put_result(f, result) File "/usr/lib/python2.6/site-packages/redux/pipes/format.py", line 86, in put_result f.write(result) File "/usr/lib64/python2.6/io.py", line 1515, in write s.__class__.__name__) TypeError: can't write str to text stream
If I re-run the same redux command, the image is found in memory and the JPG to PNG conversion works. This is what is shown in the redux log on the second attempt:
REQUEST: server_host=localhost&oformat=PNG&filename=/root/test.jpg IN MEMORY: Format(29527312,oformat=PNG,overlay=,overlaycolor=0.1,rgb=False)
This test is reproducible. If I manually remove the cached file and re-run the redux command it will fail again.
I'm using Leginon 3.0 on CentOS 6.5.
Any ideas?
Thanks,
Steve
Replies (6)
RE: Redux error: "can't write str to text stream" - Added by Anchi Cheng over 10 years ago
I have not been able to reproduced the error here and Sargis hasn't had the chance to look at it further.
What is your fs version ? It might be where that is different.
RE: Redux error: "can't write str to text stream" - Added by Anchi Cheng over 10 years ago
Do you want to try Harry Hsu's fix for his somewhat differen problem in RE: redux type erro ?
Hi, By changing line 82 in ..../site-packages/redux/cache.py to ------- f = self.diskcache.open(resultfilename, 'wb')
One thing I've noticed is that all of these error log contains a curious two decimal number before it crashed with the Trace Back. I don't see that with my working test.
RE: Redux error: "can't write str to text stream" - Added by Long Gui over 10 years ago
Hello Anchi,
Thank you very much for your help this afternoon! I really appreciate that you helped me so much on the Leginon installation on T12. As you know, we are also installing Leginon 3.0 on a 64-bit CentOS and everything goes well until we have the same problem with Redux.
At the beginning, the redux works well and the test image could be displayed nicely. However, after we run fttw
./fftwsetup.py 1 7676 7420
and restart the computer, test images could not be displayed and showed “redux does not return anything” even when reduxd service is running.
So I tried to run redux command without reduxd service required.
redux --filename=test.jpg --oformat=PNG > test.png
To my surprise, the redux command seems to run ok but produce the output text.png with 0 byte (no information inside).
I have also attached the redux.cfg and redux.log file. I have also set /var/cache/myami/redux folder to be writable. Could you help us to fix this redux problem?
Thanks a lot,
Long
RE: Redux error: "can't write str to text stream" - Added by Anchi Cheng over 10 years ago
First, it will be a good idea to set log file to a location with full path so it is consistent, such as /var/log/redux/redux.log
Maybe we are looking at the wrong redux.log Without the full path, it will attempt to log at where you started reduxd which may not be writable.
The caching write problem would appear both in server run as well as direct run. I don't the error message matching your test script.
Have you tried my suggestion above ?
If that does not work, try turn off cache in redux.cfg, it should work like in Steve's case.
RE: Redux error: "can't write str to text stream" - Added by Steve Wilson over 10 years ago
Thanks for the responses...
The version of the Python fs package is 0.5.0 for Python 2.6. And I am using Python 2.6.6.
I tried the fix suggested by Harry Hsu and that has fixed the problem for me.
Steve
RE: Redux error: "can't write str to text stream" - Added by Anchi Cheng over 10 years ago
Thanks for letting us know. I committed his change to our repository for trunk, 3.0, and 3.1 version.