10000 Give more explicit ImportErrors · Issue #261 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

Give more explicit ImportErrors #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
filmor opened this issue Sep 7, 2016 · 8 comments
Closed

Give more explicit ImportErrors #261

filmor opened this issue Sep 7, 2016 · 8 comments
Milestone

Comments

@filmor
Copy link
Member
filmor commented Sep 7, 2016

Currently, an ImportError raised from Python.NET does not include information on the actual dependency that failed to load.

@den-run-ai
Copy link
Contributor

related? #111

@filmor
Copy link
Member Author
filmor commented Sep 7, 2016

Could be. I just recognised this today as a problem, when I (again) had to do an clr.AddReference ... .GetDependentAssemblies-dance to find out which library could not be loaded.

@den-run-ai
Copy link
Contributor

@filmor the problem is that some third-party packages try to import some libraries and have backup logic if no success. So how would we distinguish between package -handled and -unhandled imports?

@filmor
Copy link
Member Author
filmor commented Sep 7, 2016

We should still raise an import error, we should just add information to the message, which assembly could not be loaded and why, basically the information that the.NET exception contains.

@den-run-ai
Copy link
Contributor

what I meant is actually cases like this and we would bug down the user with optional imports failing:

https://github.com/pydata/pandas/blob/master/pandas/computation/__init__.py

@filmor
Copy link
Member Author
filmor commented Sep 7, 2016
10000

That's not what I'm saying, I'm suggesting keeping the ImportError and just extending the information it carries, i.e. you get ImportError: No module named 'bla', tried to import bla.dll but failed loading the dependency blubb.dll because of reasons.

@den-run-ai
Copy link
Contributor

@filmor agreed! we need to extend the passed information.

fdanny pushed a commit to fdanny/pythonnet that referenced this issue Dec 1, 2016
…missing dependencies with ImportError Exceptions
fdanny pushed a commit to fdanny/pythonnet that referenced this issue Dec 2, 2016
@den-run-ai den-run-ai added this to the 2.3.0 milestone Feb 2, 2017
vmuriart pushed a commit to vmuriart/pythonnet that referenced this issue Feb 22, 2017
…missing dependencies with ImportError Exceptions
vmuriart pushed a commit to vmuriart/pythonnet that referenced this issue Feb 22, 2017
vmuriart pushed a commit to vmuriart/pythonnet that referenced this issue Feb 22, 2017
…missing dependencies with ImportError Exceptions
vmuriart pushed a commit to vmuriart/pythonnet that referenced this issue Feb 22, 2017
@filmor filmor removed the easy label Mar 5, 2017
@vmuriart vmuriart modified the milestones: 2.4.0, 2.3.0 Mar 10, 2017
@filmor filmor modified the milestones: 2.4.0, 2.5.0 Apr 12, 2019
lostmsu added a commit to losttech/pythonnet that referenced this issue Mar 4, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit to losttech/pythonnet that referenced this issue Mar 4, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit to losttech/pythonnet that referenced this issue Apr 23, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
@lostmsu
Copy link
Member
lostmsu commented Apr 27, 2020

@filmor the right way to do it is to enable Fusion Log on Windows or set Mono debug environment variables for Mono.

@lostmsu lostmsu closed this as completed Apr 27, 2020
lostmsu added a commit to losttech/pythonnet that referenced this issue Apr 27, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit to losttech/pythonnet that referenced this issue May 13, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit to losttech/pythonnet that referenced this issue Aug 18, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit to losttech/pythonnet that referenced this issue Aug 18, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit to losttech/pythonnet that referenced this issue Aug 18, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit to losttech/pythonnet that referenced this issue Aug 18, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit to l 7C3B osttech/pythonnet that referenced this issue Aug 18, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses pythonnet#261
It is an alternative to pythonnet#298
lostmsu added a commit that referenced this issue Aug 19, 2020
…ore info when CLR assemblies are failed to be loaded

1. When trying to implicitly load assemblies, and that fails NOT because an assembly is missing, but because loading failed for some reason, emit Python warning.
2. When trying to import a module in our import hook, if the module name is an assembly name, and we fail to load it, and Python also fails to find a module with the same name, add the exceptions we got during the attempt to load it into __cause__ of the final ImportError

BREAKING: clr.AddReference will now throw exceptions besides FileNotFoundException.

Additional: a few uses of BorrowedReference

This addresses #261
It is an alternative to #298
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0