Example has no methods after import · Issue #315 · go-python/gopy · GitHub
Skip to content

Example has no methods after import #315

Closed

Description

@trueToastedCode
$ go mod init dummy.com/dum
$ go get github.com/go-python/gopy/_examples/hi
$ gopy build -output=out -vm=python3 github.com/go-python/gopy/_examples/hi
$ ls out
Makefile			_hi.cpython-39-darwin.h		build.py			hi.c				hi.py
__init__.py			_hi.cpython-39-darwin.so	go.py				hi.go				hi_go.h
$ python3
>>> from out import hi
>>> dir(hi)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_collections_abc', '_hi', 'collections', 'currentdir', 'cwd', 'go', 'inspect', 'os', 'sys']
>>>  hi.Hello("you")
  File "<stdin>", line 1
    hi.Hello("you")
IndentationError: unexpected indent

It's not just the example... same result with my own go code.

which python3
/usr/bin/python3
  • Python 3.9.6
  • Go 1.20
  • MacOS Ventura 13.2 (ARM64)
  • Goopy 0.4.4

Activity

  1. trueToastedCode commented on Feb 14, 2023

    @trueToastedCode
    Author
    $ go mod init dummy.com/dum
    $ go get github.com/go-python/gopy/_examples/hi
    $ gopy build -output=out -vm=python3 github.com/go-python/gopy/_examples/hi
    $ ls out
    Makefile			_hi.cpython-39-darwin.h		build.py			hi.c				hi.py
    __init__.py			_hi.cpython-39-darwin.so	go.py				hi.go				hi_go.h
    $ python3
    >>> from out import hi
    >>> dir(hi)
    ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_collections_abc', '_hi', 'collections', 'currentdir', 'cwd', 'go', 'inspect', 'os', 'sys']
    >>>  hi.Hello("you")
      File "<stdin>", line 1
        hi.Hello("you")
    IndentationError: unexpected indent
    

    It's not just the example... same result with my own go code.

    which python3
    /usr/bin/python3
    
    • Python 3.9.6

    • Go 1.20

    • MacOS Ventura 13.2 (ARM64)

    • Goopy 0.4.4

    Duplicate of: #311

    Downgrade Go to 1.19.5 and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions