4

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?

Community
  • 1
  • 1
Dat Chu
  • 10,822
  • 13
  • 58
  • 82

1 Answers1

3

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.

Rob
  • 7,420
  • 3
  • 17
  • 12