Python 3.2.1

  • Simon

    Simon - 2011-08-04

    I've been trying to compile GDSPy for Python 3.2.1, but it fails. I'm getting:

    byte-compiling C:\Python32\Lib\site-packages\gdspy\ to boolean.pyc
      File "C:\Python32\Lib\site-packages\gdspy\", line 202
        y1 = long(segment1.points.xy + segment1.points.xy) // 2L
    SyntaxError: invalid syntax

    byte-compiling C:\Python32\Lib\site-packages\gdspy\ to gdspy.pyc
      File "C:\Python32\Lib\site-packages\gdspy\", line 65
        mantissa = long(value * 16L**(14 - exponent))
    SyntaxError: invalid syntax

    byte-compiling C:\Python32\Lib\site-packages\gdspy\ to viewer.pyc
      File "C:\Python32\Lib\site-packages\gdspy\", line 31
        print "gdspy - WARNING: the modules Image and ImageDraw were not found. Imag
    e output functions will be disabled."

    SyntaxError: invalid syntax

    byte-compiling C:\Python32\Lib\site-packages\gdspy\ to __init__.pyc
    running install_egg_info
    Writing C:\Python32\Lib\site-packages\gdspy-0.2.8-py3.2.egg-info

    Is there a chance that there will be a Python 3.x compatible build? The tool I want it to work with has 3.2 built in.

  • Heitzmann

    Heitzmann - 2011-08-04

    Unfortunately gdspy is not compatible with Python 3 yet.
    Numpy itself has only started to be compatible in their latest release, and it is a dependency for gdspy.

    I'm planning to migrate it in the next releases, but that means I'll probably have to maintain 2 versions (python 2 is not going to disappear so soon), and it will take some time.

    Anyway, it shouldn't be hard to modify the code with 2to3, if you feel like giving it a try.


  • Simon

    Simon - 2011-08-05

    Thanks for the quick response. Sounds like a challenge, though I've only just begun to touch Python altogether, I'm not sure I'd be the right candidate to mess up your code to work with Python 3. But if I have some time, I'll give it a try. Numpy btw compiles fine on 3.2. Not sure if there are any incompatibilities in its API compared to the version used for Python 2, but I guess I'll notice soon enough.

  • Simon

    Simon - 2011-08-05

    Hey Lucas, I managed to port it to Python 3 quite easily. The following site was a great help, most of the compilation issues were directly related to the items mentioned there: When I was already pretty much done, I also stumbled on the following site: It describes a way to have a distribution that supports both Python 2 and 3 using a module 2to3.

    If you wish for me to send you the Python 3 compatible version of 0.2.8, please let me know where to send it, or add me to the project.

    And of course, thanks for your efforts and sharing this module!

  • Heitzmann

    Heitzmann - 2011-08-05

    That's great news!

    I'll take a look at the links you mentioned and try to keep both version 2 and 3 working.
    I've been fixing some obscure bugs, so I should have a new release soon… maybe I'll include this.

    I can't open the project for new developers right now because I've just found that I might have to modify the license (dual license, maybe) due to my University policies (I'm a grad student), and I've just sent in a lot of paperwork that lists all authors of the project to the legal department.

    Thanks for the input, though! That'll be very useful!

  • Simon

    Simon - 2011-08-08

    I see, I hope the dual license keeps it open to the public. Anyhow, I needed to change a few additional things, it works fine now, although I've only tested the GdsImport, which is the only function I use. If you want to have the modified code just let me know where to send it.


Log in to post a comment.