ntpath.py returns TypeError: expected str, bytes or os.PathLike object, not NoneType

Viewed 1608

When I built a 'build' folder using cx_freeze, I stumbled upon this error:

'TypeError: expected str, bytes or os.PathLike object, not NoneType', followed by the error message that said that the error was on line 183 in ntpath.py.

I have checked the file, and there is nothing wrong with it. I have tried making try/except blocks, but that hasn't worked. Here is my full traceback:

Traceback (most recent call last):
  File "C:\Users\Vincent\anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 40, in run
    module.run()
  File "C:\Users\Vincent\anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 37, in run
    exec(code, {'__name__': '__main__'})
  File "sports_prediction.py", line 32, in <module>
  File "C:\Users\Vincent\anaconda3\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "C:\Users\Vincent\anaconda3\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
    from . import conv_utils
  File "C:\Users\Vincent\anaconda3\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "C:\Users\Vincent\anaconda3\lib\site-packages\keras\backend\__init__.py", line 1, in <module>
    from .load_backend import epsilon
  File "C:\Users\Vincent\anaconda3\lib\site-packages\keras\backend\load_backend.py", line 90, in <module>
    from .tensorflow_backend import *
  File "C:\Users\Vincent\anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf
  File "C:\Users\Vincent\anaconda3\lib\site-packages\tensorflow\__init__.py", line 29, in <module>
    from tensorflow._api.v1 import compat
  File "C:\Users\Vincent\anaconda3\lib\site-packages\tensorflow\_api\v1\compat\__init__.py", line 21, in <module>
    from tensorflow._api.v1.compat import v1
  File "C:\Users\Vincent\anaconda3\lib\site-packages\tensorflow\_api\v1\compat\v1\__init__.py", line 626, in <module>
    child_package_str=('tensorflow_estimator.python.estimator.api.estimator'))
  File "C:\Users\Vincent\build\exe.win-amd64-3.7\lib\tensorflow\python\tools\component_api_helper.py", line 85, in package_hook
    set_child_as_subpackage()
  File "C:\Users\Vincent\build\exe.win-amd64-3.7\lib\tensorflow\python\tools\component_api_helper.py", line 69, in set_child_as_subpackage
    os.path.join(os.path.dirname(child_pkg.__file__), ".."))]
  File "C:\Users\Vincent\anaconda3\lib\ntpath.py", line 221, in dirname
    def dirname(p):
  File "C:\Users\Vincent\anaconda3\lib\ntpath.py", line 183, in split
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Here is the 'split' part of ntpath.py that gives the error:

def split(p):
        """Split a pathname.

    Return tuple (head, tail) where tail is everything after the final slash.
    Either part may be empty."""
    p = os.fspath(p)
    seps = _get_bothseps(p)
    d, p = splitdrive(p)
    # set i to index beyond p's last slash
    i = len(p)
    while i and p[i-1] not in seps:
        i -= 1
    head, tail = p[:i], p[i:]  # now tail has no slashes
    # remove trailing slashes from head, unless it's all slashes
    head = head.rstrip(seps) or head
    return d + head, tail
0 Answers
Related