Home > Enterprise >  Why do I get a platformdirs.mac error from my libraries when I use PyInstaller?
Why do I get a platformdirs.mac error from my libraries when I use PyInstaller?

Time:12-26

I do not understand why I am receiving this error which appears to be in line 10, and I troubleshooted and found out that this is a pylint library. My pylint is upgraded to the latest version. I was wondering why I am receiving an error when importing pylint? These are my first few lines (all the libraries)

from PyQt5.QtWidgets import QApplication, QTextEdit, QWidget, QPlainTextEdit, QTabBar, QPushButton, QMainWindow, QMenuBar, QAction, QVBoxLayout, QToolBar, QToolButton, QMenu, QLineEdit, QTreeView, QFileSystemModel, QTabWidget, QTreeWidget, QTreeWidgetItem, QStyle, QAbstractItemView, QHBoxLayout, QSplitter, QLabel, QDesktopWidget, QStylePainter, QStyleOptionButton, QInputDialog, QFileDialog, QMessageBox
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtGui import QKeySequence, QFont, QIcon, QFontMetrics, QTextCursor, QPainter, QColor, QImage
from PyQt5.QtCore import pyqtSlot, QRect, pyqtSignal, QDir, Qt, QUrl, QSocketNotifier, QSize
from PyQt5 import QtSvg
from PyQt5.Qsci import QsciScintilla, QsciLexerPython, QsciLexerCSS, QsciLexerHTML, QsciLexerJavaScript, QsciLexerCustom, QsciAPIs
import PyQt5
from qtconsole.rich_jupyter_widget import RichJupyterWidget
from qtconsole.manager import QtKernelManager
from pathlib import Path
from pylint import lint
from pylint.reporters.text import TextReporter
import os
import re
#os.environ['QT_API'] = 'pyqt5'
import subprocess
import sys
import shutil
import pickle
import threading
import webbrowser
import locale, pty, struct, termios
from datetime import datetime

and this is the error I am receiving for these libraries when I run pyinstaller --onefile main.py

Traceback (most recent call last):
  File "main.py", line 11, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "pylint/lint/__init__.py", line 76, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "pylint/lint/parallel.py", line 8, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "pylint/reporters/__init__.py", line 27, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "pylint/utils/__init__.py", line 48, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "pylint/utils/docs.py", line 8, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "pylint/constants.py", line 7, in <module>
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "platformdirs/__init__.py", line 31, in <module>
  File "platformdirs/__init__.py", line 27, in _set_platform_dir_class
  File "importlib/__init__.py", line 127, in import_module
ModuleNotFoundError: No module named 'platformdirs.macos'

Thank you in advance for your help!

CodePudding user response:

Have you tried installing platformdirs https://pypi.org/project/platformdirs/ separately?

pip install -U platformdirs

There was a recent change in pylint switching from appdirs to platformdirs https://github.com/PyCQA/pylint/issues/4886 .

CodePudding user response:

Off chance, but do you have more than one instance of python installed on your current OS? I have imported a few modules from time to time only to realize that I placed it in the wrong python lib.

  • Related