ValueError: attempted relative import beyond top-level package

前端 未结 3 1765
情书的邮戳
情书的邮戳 2020-12-24 10:46

I was playing the the Python\'s import system in order to understand better how it works, and I encountered another problem. I have the following structure

         


        
3条回答
  •  一个人的身影
    2020-12-24 11:41

    I found this solution:

    #! /usr/bin/env python
    import os
    import sys
    sys.path.append(os.path.realpath('.'))
    from d import *
    

提交回复
热议问题