1

I have python 2.6 and python installed on my Freebsd box. I want my bash script to execute a particular python script using python2.6 interpreter. It is showing import error.... Undefined symbol "PyUnicodeUCS2_DecodeUTF8"

ajaxisme
  • 45
  • 2
  • 9

4 Answers4

0

file.sh

result=`python ~/PythonScriptName.py`;
MONTYHS
  • 926
  • 1
  • 7
  • 30
0

It is probably caused by the following.

Your script imports some third-party library which was compiled by an older python version.

To fix this, reinstall the up-to-date library.

Peng Zhang
  • 3,475
  • 4
  • 33
  • 41
0

Use the absolute path to the python version you want.

joel3000
  • 1,249
  • 11
  • 22
0

In the first line of the script, mention the shebang(#!)

#!/usr/bin/env python
# Your script here

The error you got due to mismatch of compilation interpreter and running interpreter.This usually occurs with a Python installation compiled with Unicode UCS2 support running modules compiled against a Python installation with Unicode UCS4 support (or vis versa).You need to recompile/reinstall the scipy installation with exact the Python interpreter used for running your code.

Fizer Khan
  • 88,237
  • 28
  • 143
  • 153