planemo icon indicating copy to clipboard operation
planemo copied to clipboard

Planemo + R = 'ascii' codec can't encode character u'\u2018'

Open lecorguille opened this issue 8 years ago • 4 comments

Hi all,

I'm used to wrap some R script/libary. And R is used to display in the stderr this kind of message:

Warning messages:
1: replacing previous import by ‘ggplot2::unit’ when loading ‘Hmisc’
2: replacing previous import by ‘ggplot2::arrow’ when loading ‘Hmisc’
3: replacing previous import by ‘scales::alpha’ when loading ‘Hmisc’

or

Error in library("foobar") : there is no package called ‘foobar’

planemo test seems to dislike those and when displaying the logs both in the stacks and in the HTML report:

======================================================================
ERROR: IPO for xcmsSet ( ipo4xcmsSet ) > Test-1
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tmpxRw9ls/galaxy-dev/test/functional/test_toolbox.py", line 299, in test_tool
    self.do_it( td )
  File "/tmp/tmpxRw9ls/galaxy-dev/test/functional/test_toolbox.py", line 78, in do_it
    raise e
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 121: ordinal not in range(128)

Consequence: the test fails even if the script is processed normally and you don't know exactly what append.

For the record: I managed to go through the first case using suppressWarnings(): suppressWarnings( suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE))))

That was my feedback! Cheers

lecorguille avatar May 18 '16 12:05 lecorguille

Not ideal, but you can probably workaround this shortcoming if you change your locale settings.

bgruening avatar May 18 '16 12:05 bgruening

@bgruening @lecorguille I have the same problem with a ° character.

"'ascii' codec can't encode character u'\xb0' in position 346

@lecorguille did you manage to make planemo test with this? I thought that my environment was good with export LANG=en_US.UTF-8 and export LC_ALL="en_US.UTF-8", I even try to set PYTHONIOENCODING=utf-8 without any success so far.

thank you.

FredericBGA avatar May 06 '20 12:05 FredericBGA

I didn't meet this issue since a while. For me, I didn't change my local settings as suggested. I just worked around with the suppressWarnings things.

lecorguille avatar May 06 '20 12:05 lecorguille

ok, thank you. I managed to make it works because of course you need to change the locale settings of the interface, not the locale settings of the terminal where planemo is running!

FredericBGA avatar May 06 '20 14:05 FredericBGA