[Python.NET] Issue with beautifulsoup 4

Daniel Fernandez fernandez_dan2 at hotmail.com
Sat May 28 14:38:21 EDT 2016


Hi All,
I narrow down the issue to a relative import of html5lib. I see there is already a pull request (https://github.com/pythonnet/pythonnet/pull/219) that addresses this relative import issue chaning the importhook.cs. 

Thanks.
Danny
From: fernandez_dan2 at hotmail.com
To: pythondotnet at python.org
Date: Fri, 27 May 2016 22:02:14 -0600
Subject: [Python.NET] Issue with beautifulsoup 4




Hey Everyone,
I'm running into an issue importing beautifulsoup 4 only if I import clr before importing beautifulsoup. I'm using python 3.5 32-bit version on my Windows 7 and Windows 10 box. I'm using beautifulsoup package from Gohlke website (beautifulsoup4-4.4.1-py3-none-any.whl)

I simply runimport clrfrom bs4 import beautifulsoup
then I get this error 
Unhandled Exception: System.ArgumentException: Name must not be empty!   at Python.Runtime.ModuleObject..ctor(String name)   at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess)   at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw)   at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw)   at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw)   at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw)   at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw)

I build the pythonnet debug version I get this call stack
Unhandled Exception: System.ArgumentException: Name must not be empty!   at Python.Runtime.ModuleObject..ctor(String name) in pythonnet\src\runtime\moduleobject.cs:line 26   at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess) in pythonnet\src\runtime\moduleobject.cs:line 101   at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 315   at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw)   at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 237   at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw)   at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 237

if I switch the lines of codefrom bs4 import Beautifulsoupimport clr
no errors occur.  Is anyone running into this issue?
Thanks.
Danny 		 	   		  

_________________________________________________
Python.NET mailing list - PythonDotNet at python.org
https://mail.python.org/mailman/listinfo/pythondotnet 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20160528/0adef8e7/attachment-0001.html>


More information about the PythonDotNet mailing list