- Make sure to close the import_failed.map file after the exception
has been raised in order to avoid ResourceWarnings when the failing import is part of a try...except block. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python39?expand=0&rev=65
This commit is contained in:
parent
40e9d58763
commit
ac13143082
@ -8,11 +8,12 @@ if __spec__:
|
|||||||
else:
|
else:
|
||||||
failed_name = __name__
|
failed_name = __name__
|
||||||
|
|
||||||
for line in open(failed_map_path):
|
with open(failed_map_path) as fd:
|
||||||
package = line.split(':')[0]
|
for line in fd:
|
||||||
imports = line.split(':')[1]
|
package = line.split(':')[0]
|
||||||
if failed_name in imports:
|
imports = line.split(':')[1]
|
||||||
raise ImportError(f"""Module '{failed_name}' is not installed.
|
if failed_name in imports:
|
||||||
|
raise ImportError(f"""Module '{failed_name}' is not installed.
|
||||||
Use:
|
Use:
|
||||||
sudo zypper install {package}
|
sudo zypper install {package}
|
||||||
to install it.""")
|
to install it.""")
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun May 2 09:20:06 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- Make sure to close the import_failed.map file after the exception
|
||||||
|
has been raised in order to avoid ResourceWarnings when the
|
||||||
|
failing import is part of a try...except block.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Apr 28 16:39:54 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
Wed Apr 28 16:39:54 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user