question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when a package stores the license file in a subdirectory

See original GitHub issue

My project started pulling version 2.5.2 for platformdirs. This platformdirs version started storing the LICENSE.txt file in a subdir (.\venv\Lib\site-packages\platformdirs-2.5.2.dist-info\license_files).

On line 171, (piplicense.py) pip-licenses tries to open the path (that it’s a dir) as a “regular” file and it fails with a “PermissionError: [Errno 13] Permission denied” error:

Traceback (most recent call last): File "c:\pablo\python\python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\pablo\python\python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Proyectos\AttackIQ\agent\aiq_agent_go\attackgraph\venv\Scripts\pip-licenses.exe\__main__.py", line 7, in <module> File "C:\Proyectos\AttackIQ\agent\aiq_agent_go\attackgraph\venv\lib\site-packages\piplicenses.py", line 893, in main output_string = create_output_string(args) File "C:\Proyectos\AttackIQ\agent\aiq_agent_go\attackgraph\venv\lib\site-packages\piplicenses.py", line 551, in create_output_string table = create_licenses_table(args, output_fields) File "C:\Proyectos\AttackIQ\agent\aiq_agent_go\attackgraph\venv\lib\site-packages\piplicenses.py", line 296, in create_licenses_table for pkg in get_packages(args): File "C:\Proyectos\AttackIQ\agent\aiq_agent_go\attackgraph\venv\lib\site-packages\piplicenses.py", line 258, in get_packages pkg_info = get_pkg_info(pkg) File "C:\Proyectos\AttackIQ\agent\aiq_agent_go\attackgraph\venv\lib\site-packages\piplicenses.py", line 178, in get_pkg_info (license_file, license_text) = get_pkg_included_file( File "C:\Proyectos\AttackIQ\agent\aiq_agent_go\attackgraph\venv\lib\site-packages\piplicenses.py", line 171, in get_pkg_included_file with open(test_file, encoding='utf-8', PermissionError: [Errno 13] Permission denied: 'c:\\proyectos\\attackiq\\agent\\aiq_agent_go\\attackgraph\\venv\\lib\\site-packages\\platformdirs-2.5.2.dist-info\\license_files'

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vaiojarsadcommented, May 2, 2022

@raimon49 Fixed!

Thank you!

Best!

1reaction
vaiojarsadcommented, Apr 20, 2022

Hi raimon49! Thank you so much for your quick feedback.

Yes, it’s a Windows-only issue (I mean the error… the logic not being able to find the license file in *nix is another related issue)…

You are calling get_pkg_included_file with (‘LICENSE*’, ‘LICENCE*’, ‘COPYING*’) as an argument for file_names.

In *nix (filesystem names are case sensitive) there is no match against the license_files subdirectory (so we get no error), but in Windows (filesystem names are case insensitive), there is a match and the logic is trying to open the subdirectory as a regular file (open call).

Best!

Pablo

Read more comments on GitHub >

github_iconTop Results From Across the Web

R devtools::check LICENSE is not mentioned and other issues ...
The get rid of the NOTE because of "LICENSE is not mentioned", you should change License: GPL-3 to License: GPL-3 + file LICENSE...
Read more >
package data in subdirectory causes warning #3340 - GitHub
Are you saying that directories in the package hierarchy that contain only data files and no Python code should be included in the...
Read more >
Building R packages - Paula Moraga
The DESCRIPTION file stores metadata of our package such as name, version number, author, license and dependencies on other packages.
Read more >
3 Building A Basic R Package - boB Rudis
Since we're saying that our package will be using the MIT license, we need to ensure there's an associated LICENSE file which we...
Read more >
Non-standard files/directories, Rbuildignore and inst
Standard, known directory and files. At the moment of writing, what a built package can contain is this list called known
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found