New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 support for version 1.0.3 #14

Closed
jachym opened this Issue Sep 5, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@jachym
Contributor

jachym commented Sep 5, 2017

Hi,

when pip installing pypotrace (from Git as well as from PyPI), I get following error, if Python3 is used

    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-abrdgocf-build/setup.py", line 70, in <module>
        cython=CYTHONIZE),
      File "/tmp/pip-abrdgocf-build/setup.py", line 51, in create_ext_obj
        pkg_config_flags = get_flags(flags, flag)
      File "/tmp/pip-abrdgocf-build/setup.py", line 24, in get_flags
        return [flag[2:] for flag in flags if flag.startswith(prefix)]
      File "/tmp/pip-abrdgocf-build/setup.py", line 24, in <listcomp>
        return [flag[2:] for flag in flags if flag.startswith(prefix)]
    TypeError: startswith first arg must be bytes or a tuple of bytes, not str

For Python-2 it works

@jachym

This comment has been minimized.

Show comment
Hide comment
@jachym

jachym Sep 5, 2017

Contributor

Still, you can not run potrace in python 3:

import potrace

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "python3.5/site-packages/potrace/__init__.py", line 1, in <module>
    from potrace._potrace import *
ImportError: python3.5/site-packages/potrace/_potrace.cpython-35m-x86_64-linux-gnu.so: undefined symbol: PyString_FromString
Contributor

jachym commented Sep 5, 2017

Still, you can not run potrace in python 3:

import potrace

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "python3.5/site-packages/potrace/__init__.py", line 1, in <module>
    from potrace._potrace import *
ImportError: python3.5/site-packages/potrace/_potrace.cpython-35m-x86_64-linux-gnu.so: undefined symbol: PyString_FromString
@alwansm

This comment has been minimized.

Show comment
Hide comment
@alwansm

alwansm Nov 13, 2017

Does python3 support potrace or not yet?
are there any alternative for potrace?

alwansm commented Nov 13, 2017

Does python3 support potrace or not yet?
are there any alternative for potrace?

@jachym

This comment has been minimized.

Show comment
Hide comment
@jachym

jachym Nov 13, 2017

Contributor

@alwansm well, I switched to python 2 :-|

Contributor

jachym commented Nov 13, 2017

@alwansm well, I switched to python 2 :-|

@alwansm

This comment has been minimized.

Show comment
Hide comment
@alwansm

alwansm commented Nov 13, 2017

@jachym :| Thank you

@BaptisteAmato

This comment has been minimized.

Show comment
Hide comment
@BaptisteAmato

BaptisteAmato May 18, 2018

For Python 3 users, you can replace the following method in setup.py:

def get_flags(flags, prefix):
    return [flag[2:].decode() for flag in flags if flag.startswith(prefix.encode())]

You also need to change the _potrace.c file, by replacing "PyString_FromString" by "PyUnicode_FromString" :)

BaptisteAmato commented May 18, 2018

For Python 3 users, you can replace the following method in setup.py:

def get_flags(flags, prefix):
    return [flag[2:].decode() for flag in flags if flag.startswith(prefix.encode())]

You also need to change the _potrace.c file, by replacing "PyString_FromString" by "PyUnicode_FromString" :)

joernschellhaas added a commit to joernschellhaas/pypotrace that referenced this issue Jul 10, 2018

joernschellhaas added a commit to joernschellhaas/pypotrace that referenced this issue Jul 10, 2018

@flupke flupke closed this in 39806c2 Jul 19, 2018

flupke added a commit that referenced this issue Jul 19, 2018

Merge pull request #15 from jachym/14_python3
fixes #14 python3 install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment