<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>atsuhiro-me</author_name>
  <author_url>https://blog.hatena.ne.jp/atsuhiro-me/</author_url>
  <blog_title>みーのぺーじ</blog_title>
  <blog_url>https://pc.atsuhiro-me.net/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>mypyが”Relative import climbs too many namespaces&quot;とエラーして，気づくのに時間がかかったのでメモしておきます． プロジェクトは以下のような構成です． src └──b.py a.py b.pyの中身は以下の通りです． from ..a import foo foo() 原因は単純で，src/に__init__.pyが存在したいため，srcがモジュールとはらなず，相対インポートでエラーするために発生します． したがって，__init__.pyを追加すると解決します． src ├── __init__.py └──b.py a.py</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpc.atsuhiro-me.net%2Fentry%2F2021%2F05%2F26%2F191624&quot; title=&quot;(mypy)Relative import climbs too many namespaces - みーのぺーじ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-05-26 19:16:24</published>
  <title>(mypy)Relative import climbs too many namespaces</title>
  <type>rich</type>
  <url>https://pc.atsuhiro-me.net/entry/2021/05/26/191624</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
