4
votes

I have a module named 'io' in my package: mypackage.io. This causes a conflict with the Python built-in io package. Thus, whenever I use PyCharm to perform debugging of my code, since pydev helper uses gzip (which in turns uses io), I encounter a module ImportError. The problem is partly due to PyCharm automatically add my package path to the interpreter path. So I am left with two options

Am I missing a better solution?

1
ops, downvoted by mistake :( sorry - ashwoods
upvoted, didn't think this deserved a -1 :-P - Rob Osborne

1 Answers

3
votes

You basically have two options:

  1. Rename your custom package
  2. Explicitly use mypackage.io.foo instead of io.foo

Generally speaking, its bad form to map a custom package atop a built-in unless you are intentionally changing that default builtin's behavior. Any short-term game will be offset by many, long-term headaches.