[Python.NET] debugging

Jason Sachs jmsachs at gmail.com
Tue Jul 23 20:30:58 CEST 2013


thanks both of you!


On Tue, Jul 23, 2013 at 8:39 AM, Daniel Krause <krausda at gmx.de> wrote:

> This link might help you:
> http://www.lfd.uci.edu/~gohlke/pythonlibs/
>
>
> 2013/7/23 Jason Sachs <jmsachs at gmail.com>
>
>> is there a prebuilt version of pythonnet for x64? I tried downloading
>> source + opening the VS10 solution file it in Visual Studio express 2013
>> but it gives a bunch of migration errors.
>>
>>
>> On Mon, Jul 22, 2013 at 5:48 PM, Bradley Friedman <brad at fie.us> wrote:
>>
>>> My best guess is that the pyd file is not built correctly for your
>>> python.
>>>
>>> When you run npython, python.runtime.dll is already linked to the .NET
>>> executable and is active.  That's why you don't need to import clr to get
>>> going.
>>>
>>> But when you run it as a module, it needs to be imported to get the clr
>>> loaded up and get python.runtime.dll linked in.  The clr.pyd is a stub to
>>> accomplish that.  And it's compiled differently per platform.
>>>
>>> That it doesn't recognize it as a valid executable suggests either a
>>> 32/64 bit issue, or that you might have a .pyd that's for linux, or some
>>> other binary incompatibility.
>>>
>>> On Jul 22, 2013, at 7:54 PM, Jason Sachs <jmsachs at gmail.com> wrote:
>>>
>>> ...yet when I run npython.exe it works fine:
>>>
>>> C:\>c:\app\python\anaconda\1.6.0\lib\site-packages\pythonnet\npython
>>> Python 2.7.5 |Anaconda 1.6.0 (64-bit)| (default, May 31 2013, 10:45:37)
>>> [MSC v.1
>>> 500 64 bit (AMD64)] on win32
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> >>> import System
>>> >>>
>>>
>>>
>>>
>>> On Mon, Jul 22, 2013 at 4:53 PM, Jason Sachs <jmsachs at gmail.com> wrote:
>>>
>>>> I'm still missing this. Here's what I tried (never mind Eclipse+pydev
>>>> for the moment, I'm just trying to run a python.exe to get what I want)
>>>>
>>>> - I created a "pythonnet" directory under site-packages
>>>> - I created a "pythonnet.pth" file that contains "pythonnet"
>>>> - I added the 5 files from pythonnet into the "pythonnet" directory
>>>> under site-packages
>>>>
>>>> and if I run python here's what I get: it shows up in sys.path but I
>>>> can't import System and if I import clr it gives me an error.
>>>>
>>>> C:\>apython
>>>> Python 2.7.5 |Anaconda 1.6.0 (64-bit)| (default, May 31 2013, 10:45:37)
>>>> [MSC v.1
>>>> 500 64 bit (AMD64)] on win32
>>>> Type "help", "copyright", "credits" or "license" for more information.
>>>> >>> import sys
>>>> >>> sys.path
>>>> ['', 'c:\\app\\python\\anaconda\\1.6.0\\Lib', 'c:
>>>> \\app\\python\\anaconda\\1.6.0\
>>>> \python27.zip', 'c:\\app\\python\\anaconda\\1.6.0\\DLLs', 'c:
>>>> \\app\\python\\anac
>>>> onda\\1.6.0\\lib\\plat-win', 'c:
>>>> \\app\\python\\anaconda\\1.6.0\\lib\\lib-tk', 'c
>>>> :\\app\\python\\anaconda\\1.6.0', 'c:
>>>> \\app\\python\\anaconda\\1.6.0\\lib\\site-p
>>>> ackages', 'c:\\app\\python\\anaconda\\1.6.0\\lib\\site-packages\\PIL',
>>>> 'c:\\app\
>>>> \python\\anaconda\\1.6.0\\lib\\site-packages\\pythonnet', 'c:
>>>> \\app\\python\\anac
>>>> onda\\1.6.0\\lib\\site-packages\\win32', 'c:
>>>> \\app\\python\\anaconda\\1.6.0\\lib\
>>>> \site-packages\\win32\\lib', 'c:
>>>> \\app\\python\\anaconda\\1.6.0\\lib\\site-packag
>>>> es\\Pythonwin', 'c:
>>>> \\app\\python\\anaconda\\1.6.0\\lib\\site-packages\\setuptool
>>>> s-0.6c11-py2.7.egg-info']
>>>> >>> import System
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>> ImportError: No module named System
>>>> >>> import clr
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>> ImportError: DLL load failed: %1 is not a valid Win32 application.
>>>>
>>>> C:\>dir c:\app\python\anaconda\1.6.0\lib\site-packages\pythonnet\
>>>>  Volume in drive C is Local Disk
>>>>  Volume Serial Number is 8242-AA56
>>>>
>>>>  Directory of c:\app\python\anaconda\1.6.0\lib\site-packages\pythonnet
>>>>
>>>> 07/22/2013  04:43 PM    <DIR>          .
>>>> 07/22/2013  04:43 PM    <DIR>          ..
>>>> 12/29/2012  04:28 PM             3,584 clr.pyd
>>>> 12/29/2012  04:27 PM           275,968 nPython.exe
>>>> 12/29/2012  04:27 PM            13,824 nPython.pdb
>>>> 12/29/2012  04:15 PM           375,296 Python.Runtime.dll
>>>> 12/29/2012  04:15 PM           411,136 Python.Runtime.pdb
>>>>                5 File(s)      1,079,808 bytes
>>>>                2 Dir(s)  339,216,891,904 bytes free
>>>>
>>>>
>>>> On Mon, Jul 22, 2013 at 3:05 PM, Bradley Friedman <brad at fie.us> wrote:
>>>>
>>>>> You may be able to drop the binaries into those locations.  Note I
>>>>> said build/acquire.  In that case you'd acquire.
>>>>>
>>>>> Deployment is another matter.
>>>>>
>>>>> When it comes to PyDev, you'll want to make sure it's using the
>>>>> PYTHONPATH and site-packages locations you think it is.  Further, you
>>>>> should probably figure out if "import clr" works.  And from there, work on
>>>>> importing .net namespaces.  If sometime fails, we'll need specific console
>>>>> output or stack traces to be of any use here I'd think.
>>>>>
>>>>> -brad
>>>>>
>>>>>
>>>
>>
>> _________________________________________________
>> Python.NET mailing list - PythonDotNet at python.org
>> http://mail.python.org/mailman/listinfo/pythondotnet
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20130723/83f63349/attachment.html>


More information about the PythonDotNet mailing list