You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
site-packages\django\contrib\sites has managment.py file which is conflicting with managment directory and causing a issue in tree get issue in _pyi_pkgutil_iter_modules as dirretory name and file are same #8191
When I execute a generated exe from pyinstaller, it is failing as django.contrib.sites has mangment.py file which is conflicting with package which by default will have management as directory.
as technically there is no management folder but when find_commands whose iterator is override by _pyi_pkgutil_iter_modules id expecting a tree node with dict but it has a file with managment.py so it is failing as str error.
If any app has management folder and also managment.py it will yield in to this issue. We can rename custom apps to avoid the file name duplication with management folder but how to deal with standard dajngo apps like django.contrib.sites
here is the stack trace
-> for pkg_name_part in pkg_prefix.parts:
(Pdb) pkg_prefix.parts
('django', 'contrib', 'sites', 'management', 'commands') ====> management here is expected a dict , as dict is not there it will be there in toc but as a file is there. it finds the file as str instead of dict and so is the assert.
(Pdb) c
Traceback (most recent call last):
File "manage.py", line 19, in
execute_from_command_line(sys.argv)
File "django\core\management_init_.py", line 442, in execute_from_command_line
File "django\core\management_init_.py", line 424, in execute
File "django\core\management_init_.py", line 222, in main_help_text
File "django\core\management_init_.py", line 78, in get_commands
File "django\core\management_init_.py", line 35, in find_commands
File "django\core\management_init_.py", line 35, in
File "C:\PythonWebCode\testone\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py", line 102, in _pyi_pkgutil_iter_modules
for pkg_name_part in pkg_prefix.parts:
AttributeError: 'str' object has no attribute 'get'
This way, we handle both the case when the path does not exist (None) and the case when the path corresponds to a module (in PYZ) instead of a package (str).
have used path exists or not to differentiate . But the above option is good and cleaner.
Aren't considering the key with management as a file and management as directory. As both are possible on OS. one of them overrides and looses the key as a dict or a file. In general similar file name and directory name.
Activity
rokm commentedon Dec 30, 2023
The following check
pyinstaller/PyInstaller/hooks/rthooks/pyi_rth_pkgutil.py
Line 102 in 7b3e347
should be changed into
This way, we handle both the case when the path does not exist (
None) and the case when the path corresponds to a module (in PYZ) instead of a package (str).tests: add pkgutil.iter_modules tests for pyinstaller#8191
eshopblr commentedon Dec 30, 2023
have used path exists or not to differentiate . But the above option is good and cleaner.
Aren't considering the key with management as a file and management as directory. As both are possible on OS. one of them overrides and looses the key as a dict or a file. In general similar file name and directory name.
tests: add pkgutil.iter_modules tests for #8191