go-python / go-python/gopy

Spectacular failure when project contains a go package named "token"

Ouverte
#229 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Go
Étoiles
2.3k
Forks
136
Merge moyen
14 min
PR mergées (30 j)
2

Description

Repro:
```
docker run -it -v `pwd`:/go/src/github.com/me/my_project docker.apple.com/golang:1.15-alpine
# in container
cd /go/src/github.com/me/my_project
apk add build-base git python3 python3-dev # Python 3.8.5
python3 -m ensurepip
go mod download
make gopy goimports
pip3 install pybindgen==0.21.0 setuptools==49.3.2 wheel==0.34.2

gopy pkg -vm=python3 -output=python -name=my_project github.com/me/my_project
```

Log excerpt:
```
--- building package ---
gopy pkg -vm=python3 -output=python -name=my_project github.com/me/my_project
goimports -w my_project.go
go build -buildmode=c-shared -o my_project_go.so .
python3 build.py
cmd had error: exit status 1 output:
oTraceback (most recent call last):
File "build.py", line 5, in
from pybindgen import retval, param, Module
File "/usr/lib/python3.8/site-packages/pybindgen/__init__.py", line 1, in
from pybindgen.typehandlers.base import ReturnValue, Parameter
File "/usr/lib/python3.8/site-packages/pybindgen/typehandlers/__init__.py", line 2, in
from pybindgen.typehandlers import base
File "/usr/lib/python3.8/site-packages/pybindgen/typehandlers/base.py", line 21, in
import logging
File "/usr/lib/python3.8/logging/__init__.py", line 26, in
import sys, os, time, io, re, traceback, warnings, weakref, collections.abc
File "/usr/lib/python3.8/traceback.py", line 5, in
import linecacheb
File "/usr/lib/python3.8/linecache.py", line 11, in
import tokenize
File "/usr/lib/python3.8/tokenize.py", line 34, in
from token import *
File "/go/src/github.com/me/my_project/python/my_project/token.py", line 12, in
import _my_project
ModuleNotFoundError: No module named '_my_project'
```

It looks like it's failing due to a bare relative import inside the python stdlib `tokenize` library, so I'm not sure if there's anything gopy can do about.

But I did want to at least get this up in an issue so some other poor soul like me can stumble across it and save some hair-pulling by renaming one of their modules.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.