3

I have Python 3.4.2, and I try to install pysqlcipher on my PC with windows 8. After having entered the code below in my command prompt:

git clone https://github.com/leapcode/pysqlcipher/
cd pysqlcipher
python setup.py build_sqlcipher

I’m getting the following error:

  File "setup.py", line 64
    print "CFLAGS", os.environ['CFLAGS']
                 ^
SyntaxError: Missing parentheses in call to 'print'

It seems to be a problem with print. I have Python 3.4.2, and the print syntax used here corresponds to Python 2.X. I have done lot of searching but I haven’t found any solution.

Does someone know how to install pysqlcipher with Python 3.4.2?

Thank you for your help!

PS: I have already followed this tutorial and all things indicated have been accomplished.

FrancNovation
  • 349
  • 6
  • 20

1 Answers1

4

It looks like the code is written for Python 2. Python 3 contains several changes that can make some Python 2 incompatible with Python 3.

Differences between python 2 and python 3

You can use the included 2to3 tool to convert the setup.py and cross_bdist_wininst.py into python 3 compatible code.

Just run 2to3 -w setup.py and 2to3 -w cross_bdist_wininst.py to convert the python code. The automatic convert works quite well but it does miss out one conversion that is necessary. Change line 209 in setup.py

-- if sources is None or type(sources) not in (ListType, TupleType):
++ if sources is None or type(sources) not in (List, Tuple):

and remove line 30:

-- from types import ListType, TupleType

This should then allow you to compile the using python setup.py build_sqlcipher

mpursuit
  • 663
  • 6
  • 22
  • Thanks a lot for your answer (I had to add to %PATH% the way \Tools\Scripts to enable 2to3 working)! Now I have a new error : `src/connection.h:33:21: fatal error: sqlite3.h: No such file or directory #include "sqlite3.h" ^ compilation terminated. error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1` Would you have any idea of the issue? – FrancNovation Feb 25 '15 at 13:24