shunfumao/RefShannon

SyntaxError: Non-ASCII character '\xef'

Opened this issue · 1 comments

Hello,

I finally managed to install the tool locally using this approach on python 3.

1. First, correct the file "path_decompose_sparse.py" inside RefShannon caused by inconsistent indentation. There are quite a few lines starting with " " instead of "\t". Replace them and the following steps should be OK.
2. python setup.py build
3. python setup.py install --prefix=${PWD}/local_build
4. export PYTHONPATH=${PWD}/local_build/lib/python3.7/site-packages/:${PYTHONPATH}

I tried running this:

python refShannon.py --help
('Running', PosixPath('/proj/jmontenegro/software/RefShannon/RefShannon/refShannon.py'))
('Importing', PosixPath('/proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/RefShannon-0.0.1-py3.7.egg/RefShannon/util.pyc'))
('Importing', PosixPath('/proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/RefShannon-0.0.1-py3.7.egg/RefShannon/sf.pyc'))
('Importing', PosixPath('/proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/RefShannon-0.0.1-py3.7.egg/RefShannon/tester.pyc'))
('Importing', PosixPath('/proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/RefShannon-0.0.1-py3.7.egg/RefShannon/run_parallel_cmds.pyc'))
('Importing', PosixPath('/proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/RefShannon-0.0.1-py3.7.egg/RefShannon/global_values.pyc'))
unknown mode: --help

but it appears the script has no help menu. So I just risked it and submitted a job using this command:

python refShannon.py --batch -i ${sam} -g ${genome} -O ${TMPDIR}/${out} -paired -N 16 -F 1 --outputFasta

but after processing the sam file to step 112 of 112 I get the following errors:

Traceback (most recent call last):
  File "/proj/jmontenegro/software/RefShannon/RefShannon/algorithm_SF.py", line 7, in <module>
    import copy,random, numpy
  File "/proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/numpy-1.19.4-py3.7-linux-x86_64.egg/numpy/__init__.py", line 292
SyntaxError: Non-ASCII character '\xef' in file /proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/numpy-1.19.4-py3.7-linux-x86_64.egg/numpy/__init__.py on line 293, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Traceback (most recent call last):
  File "/proj/jmontenegro/software/RefShannon/RefShannon/algorithm_SF.py", line 7, in <module>
    import copy,random, numpy
  File "/proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/numpy-1.19.4-py3.7-linux-x86_64.egg/numpy/__init__.py", line 292
SyntaxError: Non-ASCII character '\xef' in file /proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/numpy-1.19.4-py3.7-linux-x86_64.egg/numpy/__init__.py on line 293, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
...
SyntaxError: Non-ASCII character '\xef' in file /proj/jmontenegro/software/RefShannon/local_build/lib/python3.7/site-packages/numpy-1.19.4-py3.7-linux-x86_64.egg/numpy/__init__.py on line 293, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Traceback (most recent call last):
  File "/proj/jmontenegro/software/RefShannon/RefShannon/refShannon.py", line 718, in <module>
    main()
  File "/proj/jmontenegro/software/RefShannon/RefShannon/refShannon.py", line 710, in main
    do_batch(args)
  File "/proj/jmontenegro/software/RefShannon/RefShannon/refShannon.py", line 676, in do_batch
    do_batch_i_g(args)
  File "/proj/jmontenegro/software/RefShannon/RefShannon/refShannon.py", line 541, in do_batch_i_g
    do_sf_I(sf_args.split())
  File "/proj/jmontenegro/software/RefShannon/RefShannon/refShannon.py", line 282, in do_sf_I
    os.chdir(res_dir) #in case cat arg too long
OSError: [Errno 2] No such file or directory: '/tmp/slurm-7849201/BLASTULA/algo_output/'

So I did not get the final results. Is this something that needs to be corrected in the source code? Or have I made an error installing this tool?

Cheers,

Juan D. Montenegro

In case anyone is interested, here is how I solved it:

  • First you have to correct the inconsistent indentation in "path_decompose_sparse.py"
  1. Create a conda environment with python2.7 and activate it.
  2. pip install all dependencies: numpy, pyfaidx, cvxopt
  3. build the refShannon git repo with python setup.py build
  4. export your PYTHONPATH to /DIR/TO/refSHANNON/build/lib
  5. run the program: python /DIR/TO/refSHANNON/RefShannon/refShannon.py

Using python>=3 breaks the tool.