TypeError: expected str, bytes or os.PathLike object, not WindowsPath while converting .py using Pyinstaller

Jimit Vaghela

While trying to build an .exe using Pyinstaller, this error is thrown:

    133235 INFO: Loading module hook 'hook-matplotlib.backends.py' from 'c:\\users\\jimit vaghela\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\site-packages\matplotlib\__init__.py", line 901, in <module>
    fail_on_error=True)
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\site-packages\matplotlib\__init__.py", line 796, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\site-packages\matplotlib\__init__.py", line 770, in _open_file_or_url
    fname = os.path.expanduser(fname)
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\ntpath.py", line 291, in expanduser
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not WindowsPath
134074 INFO: Loading module hook 'hook-matplotlib.py' from 'c:\\users\\jimit vaghela\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\site-packages\matplotlib\__init__.py", line 901, in <module>
    fail_on_error=True)
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\site-packages\matplotlib\__init__.py", line 796, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\site-packages\matplotlib\__init__.py", line 770, in _open_file_or_url
    fname = os.path.expanduser(fname)
  File "c:\users\jimit vaghela\appdata\local\programs\python\python37\lib\ntpath.py", line 291, in expanduser
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not WindowsPath

I have found a solution posted on the Stackoverflow which states that there needs to be inserted a code into the backend.py in the Pyinstaller folder. But that does not work either.

What is going wrong here?

Jimit Vaghela

So, I found out that matplotlib was the issue. Excluding that in the module argument in Pyinstaller fixed it.

Like this:

pyinstaller --exclude-module matplotlib main.py

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

TypeError: expected str, bytes or os.PathLike object, not FileStorage while reading pdf files using flask

From Dev

TypeError: expected str, bytes or os.PathLike object, not Series

From Dev

TypeError: expected str, bytes or os.PathLike object, not TextIOWrapper in tkinter

From Dev

Getting a TypeError: expected str, bytes or os.PathLike object, not InMemoryUploadedFile

From Dev

TypeError: expected str, bytes or os.PathLike object, not method

From Dev

pyqtdeploy : TypeError: expected str, bytes or os.PathLike object, not NoneType

From Dev

TypeError: expected str, bytes or os.PathLike object, not tuple

From Dev

Django TypeError: Expected str, bytes or os.PathLike object, not NoneType

From Dev

TypeError: expected str, bytes or os.PathLike object, not Image

From Dev

Pytumblr - TypeError: expected str, bytes or os.PathLike object, not BufferedReader

From Dev

TypeError: expected str, bytes or os.PathLike object, not NoneType error while downloading attachment

From Dev

TypeError: expected str, bytes or os.PathLike object, not NoneType while trying to install muonic

From Dev

TypeError: expected str, bytes or os.PathLike object, not TextIOWrapper when using open() to open a file

From Dev

Where is this TypeError coming from? (Using actin for stellar activity indices) TypeError: expected str, bytes or os.PathLike object, not bool

From Java

TypeError: expected str, bytes or os.PathLike object, not _io.BufferedReader

From Dev

Code Error: TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper

From Python

PIL and tkinter error: TypeError: expected str, bytes or os.PathLike object, not list

From Dev

TypeError: expected str, bytes or os.PathLike object, not FileStorage keeps popping up

From Dev

When deploy on Heroku, report TypeError: expected str, bytes or os.PathLike object, not tuple

From Python

Sorting PDF reports into proper directories "TypeError: expected str, bytes or os.PathLike object, not list"

From Dev

TypeError: expected str, bytes or os.PathLike object, not tuple, in a minimal Django application

From Dev

Python3.x: TypeError: expected str, bytes or os.PathLike object, not list

From Dev

TypeError: expected str, bytes or os.PathLike object, not _io.BytesIO

From Dev

Python work creating BED file - TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper

From Dev

Failed to upload file with the TypeError : expected str, bytes or os.PathLike object, not list

From Dev

Python TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper

From Dev

TypeError: expected str, bytes or os.PathLike object, not int; in subprocess.run()

From Dev

TypeError: expected str, bytes or os.PathLike object, not tuple. How to solve?

From Dev

Difficulty with PIL - TypeError: expected str, bytes or os.PathLike object, not Image

Related Related

  1. 1

    TypeError: expected str, bytes or os.PathLike object, not FileStorage while reading pdf files using flask

  2. 2

    TypeError: expected str, bytes or os.PathLike object, not Series

  3. 3

    TypeError: expected str, bytes or os.PathLike object, not TextIOWrapper in tkinter

  4. 4

    Getting a TypeError: expected str, bytes or os.PathLike object, not InMemoryUploadedFile

  5. 5

    TypeError: expected str, bytes or os.PathLike object, not method

  6. 6

    pyqtdeploy : TypeError: expected str, bytes or os.PathLike object, not NoneType

  7. 7

    TypeError: expected str, bytes or os.PathLike object, not tuple

  8. 8

    Django TypeError: Expected str, bytes or os.PathLike object, not NoneType

  9. 9

    TypeError: expected str, bytes or os.PathLike object, not Image

  10. 10

    Pytumblr - TypeError: expected str, bytes or os.PathLike object, not BufferedReader

  11. 11

    TypeError: expected str, bytes or os.PathLike object, not NoneType error while downloading attachment

  12. 12

    TypeError: expected str, bytes or os.PathLike object, not NoneType while trying to install muonic

  13. 13

    TypeError: expected str, bytes or os.PathLike object, not TextIOWrapper when using open() to open a file

  14. 14

    Where is this TypeError coming from? (Using actin for stellar activity indices) TypeError: expected str, bytes or os.PathLike object, not bool

  15. 15

    TypeError: expected str, bytes or os.PathLike object, not _io.BufferedReader

  16. 16

    Code Error: TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper

  17. 17

    PIL and tkinter error: TypeError: expected str, bytes or os.PathLike object, not list

  18. 18

    TypeError: expected str, bytes or os.PathLike object, not FileStorage keeps popping up

  19. 19

    When deploy on Heroku, report TypeError: expected str, bytes or os.PathLike object, not tuple

  20. 20

    Sorting PDF reports into proper directories "TypeError: expected str, bytes or os.PathLike object, not list"

  21. 21

    TypeError: expected str, bytes or os.PathLike object, not tuple, in a minimal Django application

  22. 22

    Python3.x: TypeError: expected str, bytes or os.PathLike object, not list

  23. 23

    TypeError: expected str, bytes or os.PathLike object, not _io.BytesIO

  24. 24

    Python work creating BED file - TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper

  25. 25

    Failed to upload file with the TypeError : expected str, bytes or os.PathLike object, not list

  26. 26

    Python TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper

  27. 27

    TypeError: expected str, bytes or os.PathLike object, not int; in subprocess.run()

  28. 28

    TypeError: expected str, bytes or os.PathLike object, not tuple. How to solve?

  29. 29

    Difficulty with PIL - TypeError: expected str, bytes or os.PathLike object, not Image

HotTag

Archive