Spectacular failure when project contains a go package named "token"
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 136
- Avg merge
- 14m
- Merged PRs (30d)
- 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.