leapcode / pysqlcipher

Python bindings for SQLCipher
https://leap.se
Other
131 stars 42 forks source link

Syntax error when installing pysqlcipher #11

Closed dionyziz closed 10 years ago

dionyziz commented 10 years ago

When installing pysqlcipher in Python 3 on mac using pip for OpenBazaar, I get the following error:

Downloading/unpacking pysqlcipher==2.6.3-1 (from -r requirements.txt (line 11))
  Downloading pysqlcipher-2.6.3-1.tar.gz (69kB): 69kB downloaded
  Running setup.py (path:/private/var/folders/ty/nt50gpgx1737thg9ll863bj80000gn/T/pip_build_dionyziz/pysqlcipher/setup.py) egg_info for package pysqlcipher
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/private/var/folders/ty/nt50gpgx1737thg9ll863bj80000gn/T/pip_build_dionyziz/pysqlcipher/setup.py", line 65
        print "CFLAGS", os.environ['CFLAGS']
                     ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/private/var/folders/ty/nt50gpgx1737thg9ll863bj80000gn/T/pip_build_dionyziz/pysqlcipher/setup.py", line 65

    print "CFLAGS", os.environ['CFLAGS']

                 ^

SyntaxError: invalid syntax
dionyziz commented 10 years ago

Any interest in this? @kalikaneko

gubatron commented 10 years ago

out of curiosity, how do python developers migrating to Python 3 deal with this?

the print a,b,c notation with spaces is quite common and now it's gone in favor of a functional syntax for print(a,b,c).

If you use print(a,b,c) in python 2.x you end up printing a tuple. What would be the fix here If I were to submit it to pysqlcipher? rewriting the print with conditionals depending on the current python version? or just dealing (in the case of this setup script) with ugly output if you are on python 2?

elijh commented 10 years ago

i am just learning a little python for the first time, but maybe:

print("CFLAGS " + os.environ['CFLAGS'])

or

print("CFLAGS %s" % (os.environs['CFLAGS'],))

both will be the same in python 2 and python 3

kalikaneko commented 10 years ago

Hi. Apart from fixing this trivial syntax error, porting to python 3 might not be trivial. Have you tried the module with python3?

kalikaneko commented 10 years ago

the right way to deal with this should be import the print function from future module, and keep up with py3 syntax if you want to try a patch and see whether the thing breaks further on:

from __future__ import print_function
...
print(foo, bar)

however, I'm doing research to see how much would it take to port the module to py3. For the moment, I do not see python3-sqlite packaged, and the original pysqlite from which I forked this project does not state its python version compatibility table.

@dionyziz however we're right now a bit busy with releasing bitmask 0.7, so this might have to wait a little. sorry for the delay.

kalikaneko commented 10 years ago

Closing since it's a duplicate of #3