Error handling when importing modules

后端 未结 3 1774
一个人的身影
一个人的身影 2020-12-09 14:37

This probably has an obvious answer, but I\'m a beginner. I\'ve got a \"module\" (really just a file with a bunch of functions I often use) at the beginning of which I impo

3条回答
  •  孤城傲影
    2020-12-09 15:20

    The easiest way is to ensure that all modules can be loaded on all systems. If that doesn't work, enclosing each import statement in a try block is the next best solution and not un-Pythonic at all.

提交回复
热议问题