Typing: MyPy failing to pick up files correctly

Created on 29 Apr 2018  路  3Comments  路  Source: python/typing

I'm running mypy 0.590 using python 3.6.3 under Kubuntu linux 14.04 LTS.

"mypy --ignore-missing-imports -v ." returns ". is not a valid Python package name".

Wild cards are failing as well:

(grab_listing) scherrey@satriani:~/projects/property/elmspace/grab_listing$ mypy --ignore-missing-imports -v *.py 

LOG:  Mypy version 0.590
LOG:  Loaded graph with 69 nodes (0.020 sec)
LOG:  Found 58 SCCs; largest has 8 nodes
LOG:  58 fresh SCCs (69 nodes) left in queue (and will remain unprocessed)
LOG:  Build finished in 0.022 seconds with 0 modules, and 0 errors
(grab_listing) scherrey@satriani:~/projects/property/elmspace/grab_listing$ mypy --ignore-missing-imports -v *.py tests

LOG:  Mypy version 0.590
LOG:  Could not load cache for tests: could not find .mypy_cache/3.6/tests/__init__.meta.json
LOG:  Metadata not found for tests
LOG:  Parsing tests/__init__.py (tests)
LOG:  Could not load cache for tests.test_grab_listing: could not find .mypy_cache/3.6/tests/test_grab_listing.meta.json
LOG:  Metadata not found for tests.test_grab_listing
LOG:  Parsing tests/test_grab_listing.py (tests.test_grab_listing)
LOG:  Could not load cache for tests.test_listing_server: could not find .mypy_cache/3.6/tests/test_listing_server.meta.json
LOG:  Metadata not found for tests.test_listing_server
LOG:  Parsing tests/test_listing_server.py (tests.test_listing_server)
LOG:  Metadata abandoned for .grab_listing: attributes are missing
LOG:  Metadata not found for .grab_listing
LOG:  Parsing /home/scherrey/projects/property/elmspace/grab_listing/grab_listing.py (.grab_listing)
LOG:  Metadata abandoned for .listing_server: attributes are missing
LOG:  Metadata not found for .listing_server
LOG:  Parsing /home/scherrey/projects/property/elmspace/grab_listing/listing_server.py (.listing_server)
LOG:  Build finished in 0.009 seconds with 5 modules, and 0 errors
Traceback (most recent call last):
  File "/home/scherrey/develop/virtualenvs/grab_listing/bin/mypy", line 11, in <module>
    sys.exit(console_entry())
  File "/home/scherrey/develop/virtualenvs/grab_listing/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
    main(None)
  File "/home/scherrey/develop/virtualenvs/grab_listing/lib/python3.6/site-packages/mypy/main.py", line 85, in main
    type_check_only(sources, bin_dir, options, flush_errors)
  File "/home/scherrey/develop/virtualenvs/grab_listing/lib/python3.6/site-packages/mypy/main.py", line 134, in type_check_only
    flush_errors=flush_errors)
  File "/home/scherrey/develop/virtualenvs/grab_listing/lib/python3.6/site-packages/mypy/build.py", line 183, in build
    flush_errors, fscache)
  File "/home/scherrey/develop/virtualenvs/grab_listing/lib/python3.6/site-packages/mypy/build.py", line 268, in _build
    graph = dispatch(sources, manager)
  File "/home/scherrey/develop/virtualenvs/grab_listing/lib/python3.6/site-packages/mypy/build.py", line 2156, in dispatch
    graph = load_graph(sources, manager)
  File "/home/scherrey/develop/virtualenvs/grab_listing/lib/python3.6/site-packages/mypy/build.py", line 2318, in load_graph
    ancestor_for=st)
  File "/home/scherrey/develop/virtualenvs/grab_listing/lib/python3.6/site-packages/mypy/build.py", line 1519, in __init__
    assert id or path or source is not None, "Neither id, path nor source given"
AssertionError: Neither id, path nor source given
(grab_listing) scherrey@satriani:~/projects/property/elmspace/grab_listing$

Most helpful comment

This bug report should really be filed here: https://github.com/python/mypy/issues/

The most suspicious line in the logs is

LOG:  Metadata abandoned for .grab_listing: attributes are missing

This makes me wonder if there is a __init__.py file in the current directory. (You shouldn't invoke mypy from inside a package, though it shouldn't crash.)

All 3 comments

This bug report should really be filed here: https://github.com/python/mypy/issues/

The most suspicious line in the logs is

LOG:  Metadata abandoned for .grab_listing: attributes are missing

This makes me wonder if there is a __init__.py file in the current directory. (You shouldn't invoke mypy from inside a package, though it shouldn't crash.)

This issue is not about runtime behavior of typing module so closing it here.

This bug report should really be filed here: https://github.com/python/mypy/issues/

The most suspicious line in the logs is

LOG:  Metadata abandoned for .grab_listing: attributes are missing

This makes me wonder if there is a __init__.py file in the current directory. (You shouldn't invoke mypy from inside a package, though it shouldn't crash.)

Thank you so much. There was a __init__.py file, and removing it solved my problem!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gvanrossum picture gvanrossum  路  8Comments

mjr129 picture mjr129  路  3Comments

feluxe picture feluxe  路  8Comments

tomzx picture tomzx  路  5Comments

sid-kap picture sid-kap  路  7Comments