Bugs Driving Me Batty

xml compatibility problem with python 2:

When read a utf-8 encoded text file and write it into xml, for sentences like:

“It’s making me nervous, l think it’s spam”

With the following code:

from lxml import etree
with open(raw_file,"r") as raw_f:
    for raw in raw_f:
        literal = " ".join(raw.split()
        etree.SubElement(sample, "raw").text = literal

I got the following error message:

ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

After check the following in python,

>>>print literal
It\xe2\x80\x99s make me nervous, l think it\xe2\x80\x99s spam
>>>print type(literal)
<type 'str'>

and the following in bash:

bash-4.1$ file -i [RAW_FILE]
[RAW_FILE]: text/plain; charset=utf-8

I realized it’s an encoding problem with python 2: In Python 3, all strings are sequences of Unicode characters, while in Python 2, a string may be of type str or of type unicode.

Solution:

Unicode is what I need, so the fix is simple, just do:

 literal= literal.decode("utf-8")

Tensorflow 1.3 import problem

When import Tensorflow 1.3 into Python 2.7, I got

ImportError: libcuda.so.1: cannot open shared object file: No such file or directory

Turned out to be a problem with running TF GPU unit test on UNV, and UNV only has CPU. Tensorflow 1.3 has separate versions for GPU and CPU.

Solution: Create a new virtualenv, install the CPU version, and run the unit tests/experiments on CPU

Eclipse problems

When launch eclipse, got

Error message case 1:

Could not launch the product because the associated workspace is currently in use by another Eclipse application

It's caused by existing .lock file in the workspace that was created by previous interrupted session.

Solution:

rm [WORKSPACE]/.metadata/.lock

Error message case 2:

Could not launch the product because the specified workspace cannot be created. The specified workspace directory is either invalid or read-only.

It's caused by the writing permission with workspace.

Solution:

sudo chmod -R ugo+rw [WORKSPACE]

X2Go client problems:

Cannot resume X2Go session

When terminate/resume X2Go session, got:

DBD::SQLite::st execute failed: disk I/O error at /usr/lib64/x2go/x2gosqlitewrapper.pl line 329.

syslog: invalid level/facility: error at /usr/lib64/x2go/x2gosqlitewrapper.pl line 332

It's due to insufficient disk space.

Solution: Clean up disk, remove files in /temp in particular

Part of window cannot be seen in X2Go

It's because of inappropriate resolution.

Solution: xrandr -s [RESOLUTION] e.g. 1665 x 966, 1654x978