[Python.NET] debugging

Jason Sachs jmsachs at gmail.com
Tue Jul 23 01:53:33 CEST 2013


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
>
> On Jul 22, 2013, at 5:50 PM, Jason Sachs <jmsachs at gmail.com> wrote:
>
> >To make PythonNet install formally inside an existing CPython, you are
> looking to build/acquire it as a module and install that module in your
> PYTHONPATH or in your site-packages for that CPython.
> >There are a number of ways to do this. depending on what you are
> downloading or building and where you are deploying.
>
> So I can't just take the pythonnet binaries and put them on PYTHONPATH or
> in site-packages? I have to build it from source as a module? Either
> PYTHONPATH or site-packages will work for me; at this point I just want to
> make it work somehow. I tried with PyDev and can't seem to get it to
> recognize that System is a valid import.
>
> This is for an in-house tool that I need to make as easy as possible to
> install and use, I just need to write up the install procedure. It uses a
> data acquisition system which has .NET libraries but nothing for "pure"
> Python.
>
>
> On Mon, Jul 22, 2013 at 1:43 PM, Bradley Friedman <brad at fie.us> wrote:
>
>> To make PythonNet install formally inside an existing CPython, you are
>> looking to build/acquire it as a module and install that module in your
>> PYTHONPATH or in your site-packages for that CPython.  There are a number
>> of ways to do this. depending on what you are downloading or building and
>> where you are deploying.
>>
>> You will likely need to better define your ultimate deployment
>> requirements/needs to figure out how you'd want to approach that issue.
>>
>> -brad
>>
>> On Jul 22, 2013, at 2:55 PM, Jason Sachs <jmsachs at gmail.com> wrote:
>>
>> > Hi there--
>> >
>> > I've used Python a lot but am new to pythondotnet. I got it running on
>> Windows 7 with no problem, by unzipping the download file, making sure
>> PYTHONPATH and PYTHONHOME were setup properly, and running npython.exe.
>> >
>> > How do you get it to run in a debugger? (either PyDev on Eclipse, or
>> Microsoft PTVS)
>> >
>> > Also, is there a way to install it "permanently" in an existing Python
>> installation so that it will pickup the pythondotnet bridge when you run
>> the regular "python.exe"?
>> >
>> > --Jason
>> > _________________________________________________
>> > 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/20130722/c17f48a4/attachment-0001.html>


More information about the PythonDotNet mailing list