jigneshvasoya / ruffus

Automatically exported from code.google.com/p/ruffus
MIT License
0 stars 0 forks source link

PDF graph output fails #74

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In Python 3, process.communicate() returns bytes, not strings. Calling 
stream.write(result_str) in ruffus.graph.graph_printout() causes an exception.

The solution is to open the output file with the 'b' flag.

I have attached a patch, which can be applied with `git apply`.

Original issue reported on code.google.com by ke...@eng.ucsd.edu on 23 Jan 2015 at 3:51

Attachments:

GoogleCodeExporter commented 9 years ago
I have tested this with pdf, svg, png, and jpg output, Python 3.3.1, and the 
current ruffus master branch (35bc8851ab).

Original comment by ke...@eng.ucsd.edu on 23 Jan 2015 at 3:53

GoogleCodeExporter commented 9 years ago
It seems like this string encoding problem occurs in other places too. For 
instance, in drmaa_wrapper.py, a tempfile is opened with mode 'w+b'. Calling 
write() with a string fails. Either call .encode() on the string first, or open 
the file with mode 'w' only.

Original comment by ke...@eng.ucsd.edu on 24 Jan 2015 at 8:29

GoogleCodeExporter commented 9 years ago
Thanks. It took me a while (not having migrated to python3 full time) to 
understand what this was about but I have applied your patch to the git 
repository. This will be in v. 2.7 hopefully in the next two weeks (before 
Valentine's day!)

Original comment by bunbu...@gmail.com on 30 Jan 2015 at 7:13

GoogleCodeExporter commented 9 years ago

Original comment by bunbu...@gmail.com on 30 Jan 2015 at 7:17

GoogleCodeExporter commented 9 years ago
Discussion copied to https://github.com/bunbun/ruffus/issues/40

Original comment by bunbu...@gmail.com on 30 Jan 2015 at 7:34

GoogleCodeExporter commented 9 years ago
I didn't realize ruffus was hosted on github. Is the Google Code page 
deprecated? Is that where I should open issues from now on?

Original comment by ke...@eng.ucsd.edu on 30 Jan 2015 at 7:43

GoogleCodeExporter commented 9 years ago
Yes please. Though for the forseeable future, I shall be check both sides.

Original comment by bunbu...@gmail.com on 24 Feb 2015 at 7:42

GoogleCodeExporter commented 9 years ago
Passing unit test:

   test/test_pipeline_printout_graph.py

The byte_count / string division proved to be more insidious than I realised. 

Original comment by bunbu...@gmail.com on 25 Feb 2015 at 5:26