From rbo at acm.org Fri Jan 2 11:39:11 2004
From: rbo at acm.org (Rodrigo B. de Oliveira)
Date: Fri Jan 2 11:59:20 2004
Subject: [Python.NET] patch to allow for null array references in method
calls
Message-ID: <000b01c3d152$06a2c580$bb57b1c8@bambook>
I've ran into a problem with Converter.ToManaged when trying to call
ILGenerator.EmitCall. EmitCall demands its last parameter (of type
System.Type[]) to be null for non-varargs methods but Converter.ToManager
wouldn't convert None to a null reference.
My solution was simply to move the explicit check for Runtime.PyNone to the
line 186, before the IsArray check:
if (value == Runtime.PyNone && !obType.IsValueType) {
result = null;
return true;
}
if (obType.IsArray) {
return ToArray(value, obType, out result, setError);
}
if (obType.IsEnum) {
return ToEnum(value, obType, out result, setError);
}
Is this correct?
Best wishes,
Rodrigo
From brian at zope.com Tue Jan 6 09:18:50 2004
From: brian at zope.com (Brian Lloyd)
Date: Tue Jan 6 09:19:31 2004
Subject: [Python.NET] patch to allow for null array references in
methodcalls
In-Reply-To: <000b01c3d152$06a2c580$bb57b1c8@bambook>
Message-ID:
Sorry to be so late replying - I'm playing catchup and
losing w/my mail :(
Thanks for the fix - I'll get this checked in w/a unit
test as soon as I can.
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
> I've ran into a problem with Converter.ToManaged when trying to call
> ILGenerator.EmitCall. EmitCall demands its last parameter (of type
> System.Type[]) to be null for non-varargs methods but Converter.ToManager
> wouldn't convert None to a null reference.
>
> My solution was simply to move the explicit check for
> Runtime.PyNone to the
> line 186, before the IsArray check:
>
>
>
> if (value == Runtime.PyNone && !obType.IsValueType) {
> result = null;
> return true;
> }
>
> if (obType.IsArray) {
> return ToArray(value, obType, out result, setError);
> }
>
> if (obType.IsEnum) {
> return ToEnum(value, obType, out result, setError);
> }
>
>
> Is this correct?
>
> Best wishes,
> Rodrigo
>
>
> _________________________________________________
> Python.NET mailing list - PythonDotNet@python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
>
From boyan_hristov at hotmail.ru Wed Jan 7 12:17:48 2004
From: boyan_hristov at hotmail.ru (Boyan Hristov)
Date: Wed Jan 7 08:40:15 2004
Subject: [Python.NET] aspx
Message-ID:
Is there any posibility to use PythonNet in asp.net application insted
c# or vb like in asp.
I embed PythonNet in a c# asp application but there are too many
problems...
--
Best Regards,
Boyan
From thane at magna-capital.com Thu Jan 8 18:21:23 2004
From: thane at magna-capital.com (Thane)
Date: Thu Jan 8 18:21:29 2004
Subject: [Python.NET] Problem with toolbar
Message-ID:
I think there's a bug in the toolbar event handler. Here's the relevant
code:
#-------------------------------------------------------
class KtIde(WinForms.Form):
"""A simple Integrated Development Environment for Python.NET
from Kokopelli Technology."""
def __init__(self):
# a bunch of stuff...
# Add a toolbar
self.toolBar1 = WinForms.ToolBar()
self.imageList1 = WinForms.ImageList(self.components)
self.toolBarButton1 = WinForms.ToolBarButton()
self.toolBar1.Buttons.Add(self.toolBarButton1)
self.toolBar1.ImageList = self.imageList1
self.toolBar1.Location = Point(0, 30)
self.toolBar1.Name = "toolBar1"
self.toolBar1.ShowToolTips = True
self.toolBar1.Size = Size(632, 28)
self.toolBar1.TabIndex = 0
#
# Image list
#
self.imageList1.ImageSize = Size(16, 16)
self.imageList1.TransparentColor = Color.Transparent
fname = "ARW01RT.ICO"
self.imageList1.Images.Add(Image.FromFile(fname))
# toolBarButtons
self.toolBarButton1.ImageIndex = 0
###################### PROBLEM ########################
self.toolBar1.ButtonClick += self.toolBar1_ButtonClick
# Or is it...?
#self.toolBar1.ButtonClick +=
WinForms.ToolBarButtonClickEventHandler(self.toolBar1_ButtonClick)
##########################################################
# more stuff....
def toolBar1_ButtonClick(self, sender, args):
'''The toolbar event handler'''
MessageBox.Show(args.ToString())
#~ if args.Button == self.toolBarButton1:
#~ MessageBox.Show("Hey, it works!")
#-------------------------------------------------------
This bombs every time I press the toolbar button -- unhandled exception.
Message is:
************** Exception Text **************
Python.Runtime.PythonException: Exception of type
Python.Runtime.PythonException was thrown.
at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
at
__System_Windows_Forms_ToolBarButtonClickEventHandlerDispatcher.Invoke(Objec
t , ToolBarButtonClickEventArgs )
at System.Windows.Forms.ToolBar.OnButtonClick(ToolBarButtonClickEventArgs
e)
at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)
at System.Windows.Forms.ToolBar.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
Any clues?
Also, this is the most fun I've had programming in a LONG time. MFC is out
the window. Brian -- my hat is off to you. Many thanks for your efforts.
Cheers,
--Thane
Thane Plummer
CEO Magna Capital
"La perfection est atteinte non quand il ne reste rien ? ajouter, mais quand
il ne reste rien ? enlever"
Antoine de St. Exupery from The Little Prince (perfection is reached not
when there's nothing left to add, but when there's nothing left to remove)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20040108/4f0a0fe2/attachment.html
From brian at zope.com Thu Jan 8 19:32:21 2004
From: brian at zope.com (Brian Lloyd)
Date: Thu Jan 8 19:32:59 2004
Subject: [Python.NET] Problem with toolbar
In-Reply-To:
Message-ID:
Glad you're enjoying it :)
What you're seeing is almost always due to an exception being raised in the
Python callback (which has nowhere good to go in a windows app - need to
think about what to do there).
The first thing to try is replacing the body of your callback with just
'pass' or 'return'. Now, if you can click the thing that calls it w/o
getting
an error, you've verified that theres some prob with the Python code.
If so, 'the debugger is your friend', as Jim always tells me :) Put a
import pdb
pdb.set_trace()
...at the top of the callback method code and go from there.
Given the one-liner in your example, the only thing I can think of is
if MessageBox hasn't been defined as a name (maybe you need to
use the fully-qualified name or import that name explicitly?)
Hope this helps,
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
-----Original Message-----
From: pythondotnet-bounces@python.org
[mailto:pythondotnet-bounces@python.org]On Behalf Of Thane
Sent: Thursday, January 08, 2004 6:21 PM
To: pythondotnet@python.org
Subject: [Python.NET] Problem with toolbar
I think there's a bug in the toolbar event handler. Here's the relevant
code:
#-------------------------------------------------------
class KtIde(WinForms.Form):
"""A simple Integrated Development Environment for Python.NET
from Kokopelli Technology."""
def __init__(self):
# a bunch of stuff...
# Add a toolbar
self.toolBar1 = WinForms.ToolBar()
self.imageList1 = WinForms.ImageList(self.components)
self.toolBarButton1 = WinForms.ToolBarButton()
self.toolBar1.Buttons.Add(self.toolBarButton1)
self.toolBar1.ImageList = self.imageList1
self.toolBar1.Location = Point(0, 30)
self.toolBar1.Name = "toolBar1"
self.toolBar1.ShowToolTips = True
self.toolBar1.Size = Size(632, 28)
self.toolBar1.TabIndex = 0
#
# Image list
#
self.imageList1.ImageSize = Size(16, 16)
self.imageList1.TransparentColor = Color.Transparent
fname = "ARW01RT.ICO"
self.imageList1.Images.Add(Image.FromFile(fname))
# toolBarButtons
self.toolBarButton1.ImageIndex = 0
###################### PROBLEM ########################
self.toolBar1.ButtonClick += self.toolBar1_ButtonClick
# Or is it...?
#self.toolBar1.ButtonClick +=
WinForms.ToolBarButtonClickEventHandler(self.toolBar1_ButtonClick)
##########################################################
# more stuff....
def toolBar1_ButtonClick(self, sender, args):
'''The toolbar event handler'''
MessageBox.Show(args.ToString())
#~ if args.Button == self.toolBarButton1:
#~ MessageBox.Show("Hey, it works!")
#-------------------------------------------------------
This bombs every time I press the toolbar button -- unhandled exception.
Message is:
************** Exception Text **************
Python.Runtime.PythonException: Exception of type
Python.Runtime.PythonException was thrown.
at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
at
__System_Windows_Forms_ToolBarButtonClickEventHandlerDispatcher.Invoke(Objec
t , ToolBarButtonClickEventArgs )
at
System.Windows.Forms.ToolBar.OnButtonClick(ToolBarButtonClickEventArgs e)
at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)
at System.Windows.Forms.ToolBar.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
Any clues?
Also, this is the most fun I've had programming in a LONG time. MFC is
out the window. Brian -- my hat is off to you. Many thanks for your
efforts.
Cheers,
--Thane
Thane Plummer
CEO Magna Capital
"La perfection est atteinte non quand il ne reste rien ? ajouter, mais
quand il ne reste rien ? enlever"
Antoine de St. Exupery from The Little Prince (perfection is reached not
when there's nothing left to add, but when there's nothing left to remove)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20040108/5f6916b2/attachment-0001.html
From huntersd at iprimus.com.au Fri Jan 9 23:06:48 2004
From: huntersd at iprimus.com.au (Michael Reitzenstein)
Date: Fri Jan 9 23:06:46 2004
Subject: [Python.NET] Initial Script Directory?
Message-ID: <5.2.0.9.0.20040110115804.00b70320@pop3.iprimus.com.au>
I have almost finished my first full project using .Net & Python, however
when trying the program out on other computers I have hit a problem when
importing modules.
I couldn't figure out how to set the directory that Python should search to
import modules when I first started integrating Python into my application,
so I did a kludge-y method where I copied the script into the program's
main directory, ran it, and then deleted the script and its compiled
equivalent once it had been ran. This works fine on my machine - but I sent
it to my friend to test out, and it wouldn't work. The scripts would copy
over fine into the program's main directory, but an exception would be
tripped when attempting to import the module.
I am guessing that the directory that Python searches in is incorrect (not
defined?) on their machine. I attempted the following at the very start of
my program:
string Dir = System.Windows.Forms.Application.ExecutablePath;
System.Environment.CurrentDirectory = Dir.Replace( "Buildmeister.exe", "" );
ProgramDir = System.Environment.CurrentDirectory;
Python.Runtime.PythonEngine.Initialize( );
Python.Runtime.PythonEngine.RunSimpleString( "sys.path[ 0 ] = '" +
ProgramDir + "'" );
Python.Runtime.PythonEngine.RunSimpleString( "chdir( '" + ProgramDir + "'" );
...But it doesn't work! Is there any simple way to set the directory that
python searches for modules?
-------------- next part --------------
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.529 / Virus Database: 324 - Release Date: 16/10/2003
From mail at martin-kretschmar.de Sat Jan 10 14:39:54 2004
From: mail at martin-kretschmar.de (Martin Kretschmar)
Date: Sat Jan 10 14:41:55 2004
Subject: [Python.NET] Python.Net affected by currently somewhat broken .Net
Multithreading?
Message-ID: <000201c3d7b1$c68516e0$b166e2c3@anonymous>
Hello,
the well respected german computer magazine c't reports in an article
of its release 26/03 on page 214, that the .Net multithreading support
currently suffers from several strangeness factors.
The class ThreadPool suffers from several anomalies:
The thread pool of a process is limited by 25 threads per processor.
GetMaxThreads() and GetAvailableThreads() deliver the values 25/25
with .Net 1.0 and 25/1000 with .Net 1.1.
The new threads obey to a pretty ackward activation pattern, new
threads are started with individual offsets of 500ms to each other!
The garbage collector starts after one minute after the demise of a
thread. If new threads are requested in between, one again suffers
the 500ms penalties from above.
Further experiments trying to start all required threads in advance
suffered from being queued automatically from thread 25 on, so
this didn't help so much either.
Running one thread under full load, makes the system take up to
5 seconds to start another thread.
Attempts to work without ThreadPool suffered also from several
anomalies and could even crash the .Net executive:
The executive is quiet sensitive when one tries to Resume() an
already running process etc, which might mean some extra
private bookkeeping.
Attempts with subclassing BaseThread worked but occasionally
resulted in a termination with return code 0 with .Net 1.0 and a
reported stack overflow with .Net 1.1.
Closing a window while one owns homemade background thread
is running creates a zombie thread.
Altogether the authors hope, that further releases of .Net like
.Net 2.0 will help to improve the situation.
Regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20040110/8a5bf62c/attachment.html
From lcaumont at pamdev.com Mon Jan 12 06:37:42 2004
From: lcaumont at pamdev.com (Laurent Caumont)
Date: Mon Jan 12 09:30:02 2004
Subject: [Python.NET] Problem whith DirectX device creation under pythonnet
Message-ID: <001101c3d900$7d79fd80$9a6d6150@pamtwo.com>
Hello,
I want to create a Directx 9.0 application with Python and Managed Directx.
Here is the code:
import CLR.System.Windows.Forms as WinForms
from CLR.System.Drawing import Size, Point
import CLR.Microsoft.DirectX
import CLR.Microsoft.DirectX.Direct3D
from CLR.Microsoft.DirectX import Matrix
from CLR.Microsoft.DirectX.Direct3D import Device, PresentParameters,
SwapEffect, DeviceType, CreateFlags
class DirectXWindow(WinForms.Form):
"""A simple hello world app that demonstrates the essentials of
winforms programming and event-based programming in Python."""
def CreateDevice(self):
presentParams = PresentParameters()
presentParams.Windowed = True
presentParams.SwapEffect = SwapEffect.Discard
device = Device(0, DeviceType.Hardware, self,
CreateFlags.SoftwareVertexProcessing, presentParams)
def __init__(self):
self.Text = "DirectX Window"
self.AutoScaleBaseSize = Size(100, 100)
self.ClientSize = Size(400, 300);
h = WinForms.SystemInformation.CaptionHeight
self.MinimumSize = Size(392, (117 + h))
self.CreateDevice()
def run(self):
WinForms.Application.Run(self)
def main():
DirectXWindow().run()
if __name__ == '__main__':
main()
I have the error:
> File "Directx.py", line 18, in CreateDevice
> TypeError: no constructor matches given arguments
Form the DirectX documentation, there are 3 constructors available:
public Device (Int32, DeviceType, IntPtr, CreateFlags, PresentParameters)
public Device (Int32, DeviceType, Control, CreateFlags, PresentParameters)
public Device (IntPtr)
The Int32 is the DeviceNum (0).
DeviceType and CreateFlags are 2 enum.
PresentParameters is a Structure.
The 'help(Device)' does'nt work.
How can I display all the signature of all constructors ?
What is the problem ?
Thanks for the help.
From vanevery at indiegamedesign.com Mon Jan 12 13:34:29 2004
From: vanevery at indiegamedesign.com (Brandon J. Van Every)
Date: Mon Jan 12 13:24:04 2004
Subject: [Python.NET] Problem whith DirectX device creation under pythonnet
In-Reply-To: <001101c3d900$7d79fd80$9a6d6150@pamtwo.com>
Message-ID:
Laurent Caumont wrote:
>
> Form the DirectX documentation, there are 3 constructors available:
> public Device (Int32, DeviceType, IntPtr, CreateFlags,
> PresentParameters)
> public Device (Int32, DeviceType, Control, CreateFlags,
> PresentParameters)
> public Device (IntPtr)
My Summer 2003 Managed Documentation only gives:
Device (Int32, DeviceType, Control, CreateFlags, PresentParameters)
Are you using the latest SDK and documentation? Not that it's any
good...
Cheers, www.indiegamedesign.com
Brandon Van Every Seattle, WA
"We live in a world of very bright people building
crappy software with total shit for tools and process."
- Ed Mckenzie
From lcaumont at pamdev.com Tue Jan 13 05:03:16 2004
From: lcaumont at pamdev.com (Laurent Caumont)
Date: Tue Jan 13 09:30:40 2004
Subject: [Python.NET] Problem whith DirectX device creation under pythonnet
Message-ID: <002901c3d9bc$76b46a00$9a6d6150@pamtwo.com>
I use the "DirectX 9.0 SDK Update (Summer 2003)" documentation.
This C# sample is very close to my code.
It use the same constructor.
Is there any way to view the constructor signature with python ?
Laurent.
-----------------------------------------
Laurent CAUMONT
3D Engineer
lcaumont@pamdev.com
PAM Development
110 rue du Lt Petit Leroy
94550 CHEVILLY LARUE
FRANCE
T?l : +33.1.46.87.44.12
Fax : +33.1.46.87.45.57
Internet : www.pamdev.com
------------------------------------------
-------------- next part --------------
//-----------------------------------------------------------------------------
// File: CreateDevice.cs
//
// Desc: This is the first tutorial for using Direct3D. In this tutorial, all
// we are doing is creating a Direct3D device and using it to clear the
// window.
//
// Copyright (c) 2000-2002 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
namespace DeviceTutorial
{
public class CreateDevice : Form
{
// Our global variables for this project
Device device = null; // Our rendering device
public CreateDevice()
{
// Set the initial size of our form
this.ClientSize = new System.Drawing.Size(400,300);
// And it's caption
this.Text = "D3D Tutorial 01: CreateDevice";
// Load our icon from the resources of the .exe
this.Icon = new Icon(this.GetType(), "directx.ico");
}
public bool InitializeGraphics()
{
try
{
// Now let's setup our D3D stuff
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed=true;
presentParams.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
return true;
}
catch (DirectXException)
{
return false;
}
}
private void Render()
{
if (device == null)
return;
//Clear the backbuffer to a blue color
device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0f, 0);
//Begin the scene
device.BeginScene();
// Rendering of scene objects can happen here
//End the scene
device.EndScene();
device.Present();
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
this.Render(); // Render on painting
}
protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
{
if ((int)(byte)e.KeyChar == (int)System.Windows.Forms.Keys.Escape)
this.Close(); // Esc was pressed
}
///
/// The main entry point for the application.
///
static void Main()
{
using (CreateDevice frm = new CreateDevice())
{
if (!frm.InitializeGraphics()) // Initialize Direct3D
{
MessageBox.Show("Could not initialize Direct3D. This tutorial will exit.");
return;
}
frm.Show();
// While the form is still valid, render and process messages
while(frm.Created)
{
frm.Render();
Application.DoEvents();
}
}
}
}
}
From brian at zope.com Tue Jan 13 10:43:13 2004
From: brian at zope.com (Brian Lloyd)
Date: Tue Jan 13 10:44:02 2004
Subject: [Python.NET] Problem whith DirectX device creation under pythonnet
In-Reply-To: <002901c3d9bc$76b46a00$9a6d6150@pamtwo.com>
Message-ID:
> I use the "DirectX 9.0 SDK Update (Summer 2003)" documentation.
>
> This C# sample is very close to my code.
> It use the same constructor.
>
> Is there any way to view the constructor signature with python ?
>
> Laurent.
Not currently, though I've put it on the todo list (I think I can
have SomeClass.__doc__ display constructor info).
Your code _looks_ right, which makes me suspect that the Python
integration layer is somehow mishandling one of the arguments. I
don't have managed directx handy, so I don't have a quick way
to check that theory :(
If you're inclined, you can probably hack the MethodBinder.cs file
to log what it's doing when it tries to convert the arguments. I'll
try to get mdx installed to try to reproduce it myself, but it may
be a few days.
Just to be sure - you are using the latest beta, right? Beta 2 had
a bug that caused problems calling ctors, so make sure you are
using the b3 release.
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
From paniq at gmx.net Wed Jan 14 05:27:31 2004
From: paniq at gmx.net (Leonard :paniq: Ritter)
Date: Wed Jan 14 05:27:10 2004
Subject: [Python.NET] error: ImportError: dynamic module does not define init
function (initASSEMBLYNAME)
Message-ID: <5.2.1.1.0.20040114112404.01f7a390@pop.gmx.de>
when loading a mixed managed c++ library that i use as .net wrapper for my object model, i get
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
does anyone have specific background information on that error and how i can avoid it?
there is no problem using the assembly in .net. i was trying to import the library after changing to the directory where the dll is located.
-- Leonard Ritter
-- paniq@gmx.net
-- http://www.quence.com
-- http://www.paniq.de
From brian at zope.com Wed Jan 14 09:36:58 2004
From: brian at zope.com (Brian Lloyd)
Date: Wed Jan 14 09:38:01 2004
Subject: [Python.NET] error: ImportError: dynamic module does not define
init function (initASSEMBLYNAME)
In-Reply-To: <5.2.1.1.0.20040114112404.01f7a390@pop.gmx.de>
Message-ID:
> when loading a mixed managed c++ library that i use as .net
> wrapper for my object model, i get
>
> >>> import QuenceNET
> Traceback (most recent call last):
> File "", line 1, in ?
> ImportError: dynamic module does not define init function (initQuenceNET)
>
> does anyone have specific background information on that error
> and how i can avoid it?
>
> there is no problem using the assembly in .net. i was trying to
> import the library after changing to the directory where the dll
> is located.
I think you just need to change it to 'import CLR.QuenceNET'
The 'CLR' prefix is important, as that is how the runtime is
able to distinguish managed imports from plain Python imports.
If you don't go through CLR, the standard Python importer will
try to import the dll as a Python C extension (which gives the
error you're seeing).
Hope this helps,
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
From paniq at gmx.net Wed Jan 14 13:10:58 2004
From: paniq at gmx.net (Leonard :paniq: Ritter)
Date: Wed Jan 14 13:10:53 2004
Subject: [Python.NET] import works only after failed import
Message-ID: <5.2.1.1.0.20040114190140.01f7a390@pop.gmx.de>
this is even funnier. importing a .net assembly seems only to work if the dll has been loaded before.
in each try, i restart python from the directory where the .net DLL is located.
first try:
O:\Quence\debug>python
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import CLR.QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named QuenceNET
second try:
O:\Quence\debug>python
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import CLR
>>> import CLR.QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named QuenceNET
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
>>> import CLR.QuenceNET
>>> dir(CLR.QuenceNET)
['__doc__', '__name__']
third try (optimized):
O:\Quence\debug>python
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import CLR
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
>>> import CLR.QuenceNET
>>> dir(CLR.QuenceNET)
['__doc__', '__name__']
fourth try (variant):
O:\Quence\debug>python
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
>>> import CLR.QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named QuenceNET
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
>>> import CLR.QuenceNET
>>> dir(CLR.QuenceNET)
['__doc__', '__name__']
so to import my custom assembly in python, the code currently looks like this:
import CLR
try:
import QuenceNET # for the error
except:
pass # catch
import CLR.QuenceNET
-- Leonard Ritter
-- paniq@gmx.net
-- http://www.quence.com
-- http://www.paniq.de
From brian at zope.com Wed Jan 14 16:38:35 2004
From: brian at zope.com (Brian Lloyd)
Date: Wed Jan 14 16:39:42 2004
Subject: [Python.NET] aspx
In-Reply-To:
Message-ID:
> Is there any posibility to use PythonNet in asp.net application insted
> c# or vb like in asp.
> I embed PythonNet in a c# asp application but there are too many
> problems...
>
> --
> Best Regards,
> Boyan
(Sorry - I'm way behind on mail). It's not currently possible to
use Python rather than C# or VB in aspx. It might be possible to
do something useful in Python from asp, but I suspect a fair bit
of work would have to be done to get there.
I could be wrong about the amount of work though - I'm not really
an expert on the internals of aspx. Maybe someone will surprise us! :)
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
From paniq at gmx.net Thu Jan 15 07:51:03 2004
From: paniq at gmx.net (Leonard :paniq: Ritter)
Date: Thu Jan 15 07:50:30 2004
Subject: [Python.NET] followup: import works only after failed import
Message-ID: <5.2.1.1.0.20040115134728.020058e0@pop.gmx.de>
update:
it seems as if
import CLR
from CLR.QuenceNET import bla
does the trick, however that doesnt work on the python prompt.
anyway, so far it all works great in the code,
thanks for that wrapper, brian, with your work you have already
filled a big hole in the compatibility chain.
----------------8<--------------------------
this is even funnier. importing a .net assembly seems only to work if the dll has been loaded before.
in each try, i restart python from the directory where the .net DLL is located.
first try:
O:\Quence\debug>python
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import CLR.QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named QuenceNET
second try:
O:\Quence\debug>python
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import CLR
>>> import CLR.QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named QuenceNET
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
>>> import CLR.QuenceNET
>>> dir(CLR.QuenceNET)
['__doc__', '__name__']
third try (optimized):
O:\Quence\debug>python
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import CLR
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
>>> import CLR.QuenceNET
>>> dir(CLR.QuenceNET)
['__doc__', '__name__']
fourth try (variant):
O:\Quence\debug>python
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
>>> import CLR.QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named QuenceNET
>>> import QuenceNET
Traceback (most recent call last):
File "", line 1, in ?
ImportError: dynamic module does not define init function (initQuenceNET)
>>> import CLR.QuenceNET
>>> dir(CLR.QuenceNET)
['__doc__', '__name__']
so to import my custom assembly in python, the code currently looks like this:
import CLR
try:
import QuenceNET # for the error
except:
pass # catch
import CLR.QuenceNET
-- Leonard Ritter
-- paniq@gmx.net
-- http://www.quence.com
-- http://www.paniq.de
From brian at zope.com Thu Jan 15 09:21:06 2004
From: brian at zope.com (Brian Lloyd)
Date: Thu Jan 15 09:22:46 2004
Subject: [Python.NET] followup: import works only after failed import
In-Reply-To: <5.2.1.1.0.20040115134728.020058e0@pop.gmx.de>
Message-ID:
> update:
>
> it seems as if
>
> import CLR
> from CLR.QuenceNET import bla
>
> does the trick, however that doesnt work on the python prompt.
>
> anyway, so far it all works great in the code,
> thanks for that wrapper, brian, with your work you have already
> filled a big hole in the compatibility chain.
Thanks! BTW, from looking at this I'm guessing that you are
using an existing Python install right? There is a known issue
right now in that you have to 'import CLR' first to bootstrap
the runtime's import hook. That isn't the case when you use
the bundled python.exe, which does the bootstrapping immediately.
I hope to be able to fix that for the next beta.
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
From brian at zope.com Fri Jan 16 13:39:27 2004
From: brian at zope.com (Brian Lloyd)
Date: Fri Jan 16 13:40:06 2004
Subject: [Python.NET] Problem whith DirectX device creation under pythonnet
In-Reply-To: <001801c3db6d$172e14c0$9a6d6150@pamtwo.com>
Message-ID:
[Copying the list on this as well, as it is probably relevant to
everyone sooner or later...]
Looking at this, I see what the issue is but I'm not sure how
to address it, other than by documentation.
The problem is the distinction between value types and reference
types and how that distinction affects you when writing in Python.
To take a boiled-down version of your example:
items = CLR.System.Array.CreateInstance(Point, 3)
for i in range(3):
items[i] = Point(0, 0)
items[0].X = 1 # won't work!!
While the spelling of 'items[0].X = 1' is the same in C# and Python,
there is an important and subtle semantic difference. In C# (and other
compiled-to-IL languages), the compiler knows that Point is a value
type and can do the Right Thing here, changing the value in place.
In Python however, "everything's a reference", and there is really no
spelling or semantic to allow it to do the right thing dynamically. The
specific reason that items[0] itself doesn't change is that when you
say 'items[0]', that getitem operation creates a Python object that
holds a reference to the object at items[0] via a GCHandle. That causes
a ValueType (like Point) to be boxed, so the following setattr ('.X = 1')
*changes the state of the boxed value, not the original unboxed value*.
Because there are no value type semantics or syntax in Python, there's
not much the runtime can do about this :( The workaround is to do what
you did, which is to make all of your changes to the boxed copy and then
set (or re-set) the item in the array.
This is not unlike some of the cases you can find in C# where you have
to know about boxing behavior to avoid similar kinds of 'lost update'
problems (generally because an implicit boxing happened that was not
taken into account in the code).
This is the same thing, just the manifestation is a little different
in Python. The rule in Python is essentially: "the result of any
attribute or item access is a boxed value", and as your example shows
that can be important in how you approach your code.
I've added a TODO to put a section about this into the docs - I'm sure
it will be a FAQ.
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
> -----Original Message-----
> From: Laurent Caumont [mailto:lcaumont@pamdev.com]
> Sent: Thursday, January 15, 2004 8:40 AM
> To: Brian Lloyd
> Subject: Re: [Python.NET] Problem whith DirectX device creation under
> pythonnet
>
>
> I have found a solution:
>
> self.vertexBuffer =
> VertexBuffer(CustomVertex.TransformedColored, 3,
> self.device, 0, CustomVertex.TransformedColored.Format, Pool.Default)
> stm = self.vertexBuffer.Lock(0, 0, 0)
> verts =
> System.Array.CreateInstance(CustomVertex.TransformedColored,
> 3)
>
> verts[0] = CustomVertex.TransformedColored(150, 50, 0.5, 1.0,
> System.Drawing.Color.Aqua.ToArgb())
> ## verts[0].X = 150.0
> ## verts[0].Y = 50
> ## verts[0].Z = 0.5
> ## verts[0].Rhw = 1.0
> ## verts[0].Color = System.Drawing.Color.Aqua.ToArgb()
> verts[1] = CustomVertex.TransformedColored(250, 250, 0.5, 1.0,
> System.Drawing.Color.Brown.ToArgb())
> ## verts[1].X = 250
> ## verts[1].Y = 250
> ## verts[1].Z = 0.5
> ## verts[1].Rhw = 1.0
> ## verts[1].Color = System.Drawing.Color.Brown.ToArgb()
> verts[2] = CustomVertex.TransformedColored(50, 250, 0.5, 1.0,
> System.Drawing.Color.LightPink.ToArgb())
> ## verts[2].X = 50
> ## verts[2].Y = 250
> ## verts[2].Z = 0.5
> ## verts[2].Rhw = 1.0
> ## verts[2].Color = System.Drawing.Color.LightPink.ToArgb()
>
> stm.Write(verts)
> self.vertexBuffer.Unlock()
>
>
> I don't know why but the comment lines do not work: the values are not
> changed. ( print verts[0].X = 0.0 ??)
>
> ----- Original Message -----
> From: "Laurent Caumont"
> To: "Laurent Caumont"
> Sent: Thursday, January 15, 2004 2:39 PM
> Subject: Re: [Python.NET] Problem whith DirectX device creation under
> pythonnet
>
>
> > I have found a solution:
> >
> > self.vertexBuffer =
> VertexBuffer(CustomVertex.TransformedColored,
> 3,
> > self.device, 0, CustomVertex.TransformedColored.Format, Pool.Default)
> > stm = self.vertexBuffer.Lock(0, 0, 0)
> > verts =
> System.Array.CreateInstance(CustomVertex.TransformedColored,
> > 3)
> >
> > verts[0] = CustomVertex.TransformedColored(150, 50, 0.5, 1.0,
> > System.Drawing.Color.Aqua.ToArgb())
> > ## verts[0].X = 150.0
> > ## verts[0].Y = 50
> > ## verts[0].Z = 0.5
> > ## verts[0].Rhw = 1.0
> > ## verts[0].Color = System.Drawing.Color.Aqua.ToArgb()
> > verts[1] = CustomVertex.TransformedColored(250, 250, 0.5, 1.0,
> > System.Drawing.Color.Brown.ToArgb())
> > ## verts[1].X = 250
> > ## verts[1].Y = 250
> > ## verts[1].Z = 0.5
> > ## verts[1].Rhw = 1.0
> > ## verts[1].Color = System.Drawing.Color.Brown.ToArgb()
> > verts[2] = CustomVertex.TransformedColored(50, 250, 0.5, 1.0,
> > System.Drawing.Color.LightPink.ToArgb())
> > ## verts[2].X = 50
> > ## verts[2].Y = 250
> > ## verts[2].Z = 0.5
> > ## verts[2].Rhw = 1.0
> > ## verts[2].Color = System.Drawing.Color.LightPink.ToArgb()
> >
> > stm.Write(verts)
> > self.vertexBuffer.Unlock()
> >
> >
> > I don't know why but the comment lines do not work: the values are not
> > changed. ( print verts[0].X = 0.0 ??)
> >
> >
> >
> > ----- Original Message -----
> > From: "Laurent Caumont"
> > To: "Brian Lloyd"
> > Sent: Thursday, January 15, 2004 12:45 PM
> > Subject: Re: [Python.NET] Problem whith DirectX device creation under
> > pythonnet
> >
> >
> > > YES. It works for me too !
> > >
> > > I am very surprise that DirectX Documentation doesn't say
> that it is an
> > > array.
> > >
> > > About arrays, I have a question:
> > > I try to convert this C# code to PythonNet like this:
> > >
> > > C#:
> > >
> > > vertexBuffer = new
> VertexBuffer(typeof(CustomVertex.TransformedColored),
> > 3,
> > > dev, 0, CustomVertex.TransformedColored.Format, Pool.Default);
> > > GraphicsStream stm = vertexBuffer.Lock(0, 0, 0);
> > > CustomVertex.TransformedColored[] verts = new
> > > CustomVertex.TransformedColored[3];
> > > verts[0].X=150;verts[0].Y=50;verts[0].Z=0.5f; verts[0].Rhw=1;
> > verts[0].Color
> > > = System.Drawing.Color.Aqua.ToArgb();
> > > verts[1].X=250;verts[1].Y=250;verts[1].Z=0.5f; verts[1].Rhw=1;
> > > verts[1].Color = System.Drawing.Color.Brown.ToArgb();
> > > verts[2].X=50;verts[2].Y=250;verts[2].Z=0.5f; verts[2].Rhw=1;
> > verts[2].Color
> > > = System.Drawing.Color.LightPink.ToArgb();
> > > stm.Write(verts);
> > > vertexBuffer.Unlock();
> > >
> > > Python:
> > >
> > > self.vertexBuffer = VertexBuffer(CustomVertex.TransformedColored, 3,
> > > self.device, 0, CustomVertex.TransformedColored.Format, Pool.Default)
> > > stm = self.vertexBuffer.Lock(0, 0, 0)
> > > verts = []
> > > verts.append(CustomVertex.TransformedColored(150, 50, 0.5, 1,
> > > Color.Aqua.ToArgb()))
> > > verts.append(CustomVertex.TransformedColored(250, 250, 0.5, 1,
> > > Color.Brown.ToArgb()))
> > > verts.append(CustomVertex.TransformedColored(50, 250, 0.5, 1,
> > > Color.LightPink.ToArgb()))
> > >
> > > stm.Write(verts)
> > > self.vertexBuffer.Unlock()
> > >
> > >
> > > "stm.Write" doesn't like my verts array. (TypeError: no method matches
> > given
> > > arguments)
> > >
> > > I have remove the 'typeof' too but I don't know if it's ok ?
> > >
> > > Thanks for the Help.
> > >
> > >
> > > ----- Original Message -----
> > > From: "Brian Lloyd"
> > > To: "Laurent Caumont"
> > > Sent: Wednesday, January 14, 2004 10:01 PM
> > > Subject: RE: [Python.NET] Problem whith DirectX device creation under
> > > pythonnet
> > >
> > >
> > > > I think I have an answer for you ;) Looking at the sig, the
> > > > 'PresentParams' arg is actually PresentParams[] (iow, array
> > > > of PresentParams rather than one).
> > > >
> > > > When I changed the call to:
> > > >
> > > > Device(0, DeviceType.Hardware, self,
> > > CreateFlags.SofwareVertexProcessing,
> > > > [presentParams])
> > > >
> > > > it worked for me.
> > > >
> > > >
> > > > Brian Lloyd brian@zope.com
> > > > V.P. Engineering 540.361.1716
> > > > Zope Corporation http://www.zope.com
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Laurent Caumont [mailto:lcaumont@pamdev.com]
> > > > > Sent: Wednesday, January 14, 2004 4:54 AM
> > > > > To: Brian Lloyd
> > > > > Subject: Re: [Python.NET] Problem whith DirectX device creation
> under
> > > > > pythonnet
> > > > >
> > > > >
> > > > > Hi Brian,
> > > > >
> > > > > Yes, I use the b3 release.
> > > > >
> > > > > I suspect the enum to be the cause of the error.
> > > > >
> > > > > If you do that:
> > > > > "dtype = DeviceType.Hardware"
> > > > > dtype is a "int" not a "DeviceType" (enum).
> > > > >
> > > > > But the constructor need a "DeviceType" not a "int".
> > > > >
> > > > > Is it possible with pyton to force the type (cast)?
> > > > >
> > > > > Thanks.
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Brian Lloyd"
> > > > > To: "Laurent Caumont" ;
>
> > > > > Sent: Tuesday, January 13, 2004 4:43 PM
> > > > > Subject: RE: [Python.NET] Problem whith DirectX device creation
> under
> > > > > pythonnet
> > > > >
> > > > >
> > > > > > > I use the "DirectX 9.0 SDK Update (Summer 2003)"
> documentation.
> > > > > > >
> > > > > > > This C# sample is very close to my code.
> > > > > > > It use the same constructor.
> > > > > > >
> > > > > > > Is there any way to view the constructor signature
> with python ?
> > > > > > >
> > > > > > > Laurent.
> > > > > >
> > > > > > Not currently, though I've put it on the todo list (I
> think I can
> > > > > > have SomeClass.__doc__ display constructor info).
> > > > > >
> > > > > > Your code _looks_ right, which makes me suspect that the Python
> > > > > > integration layer is somehow mishandling one of the arguments. I
> > > > > > don't have managed directx handy, so I don't have a quick way
> > > > > > to check that theory :(
> > > > > >
> > > > > > If you're inclined, you can probably hack the
> MethodBinder.cs file
> > > > > > to log what it's doing when it tries to convert the arguments.
> I'll
> > > > > > try to get mdx installed to try to reproduce it myself,
> but it may
> > > > > > be a few days.
> > > > > >
> > > > > > Just to be sure - you are using the latest beta, right?
> Beta 2 had
> > > > > > a bug that caused problems calling ctors, so make sure you are
> > > > > > using the b3 release.
> > > > > >
> > > > > >
> > > > > > Brian Lloyd brian@zope.com
> > > > > > V.P. Engineering 540.361.1716
> > > > > > Zope Corporation http://www.zope.com
> > > > > >
> > > > > >
> > > > >
> > > > >
> > >
> >
>
>
From lcaumont at pamdev.com Thu Jan 22 08:31:08 2004
From: lcaumont at pamdev.com (Laurent Caumont)
Date: Thu Jan 22 09:40:50 2004
Subject: [Python.NET] Problem whith DirectX Mesh importation
References:
Message-ID: <005701c3e0ec$0044fa10$9a6d6150@pamtwo.com>
"from CLR.Microsoft.DirectX.Direct3D import Mesh"
=> ImportError: cannot import name Mesh
It seems that 'Mesh' is define in the Direct3DX library because when I
remove the reference the "Microsoft.DirectX.Direct3DX" in the reference list
in a directx C# sample, I have the same error...
How can I add a refrence like in C# ?
The "import CLR.Microsoft.DirectX.Direct3DX as D3DX" doesn't work.
Thanks for help.
From brian at zope.com Thu Jan 22 10:02:55 2004
From: brian at zope.com (Brian Lloyd)
Date: Thu Jan 22 10:03:32 2004
Subject: [Python.NET] RE: Problem whith DirectX Mesh importation
In-Reply-To: <005701c3e0ec$0044fa10$9a6d6150@pamtwo.com>
Message-ID:
> "from CLR.Microsoft.DirectX.Direct3D import Mesh"
>
> => ImportError: cannot import name Mesh
>
> It seems that 'Mesh' is define in the Direct3DX library because when I
> remove the reference the "Microsoft.DirectX.Direct3DX" in the
> reference list
> in a directx C# sample, I have the same error...
>
> How can I add a refrence like in C# ?
>
> The "import CLR.Microsoft.DirectX.Direct3DX as D3DX" doesn't work.
>
> Thanks for help.
What is the actual name of the _assembly_ that implements the
Direct3DX library?
Remember that the name-based import in Python is linked to
namespaces, and 'implicit assembly loading' only happens if
the namespace you are trying to import happens to match the
name of the assembly implementing it (which luckily is often,
but not always, the case).
So for example, if the assembly is actually named 'Direct3DX.dll',
you'll need to load the assembly explicitly before attempting to
import the namespace, since the names don't match. There is an
example of this in the README for Python for .NET:
from CLR.System.Reflection import Assembly
a = Assembly.LoadWithPartialName("SomeAssembly")
# now we can import namespaces defined in that assembly
from CLR.SomeNamespace import Something
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
From lcaumont at pamdev.com Thu Jan 22 11:05:47 2004
From: lcaumont at pamdev.com (Laurent Caumont)
Date: Thu Jan 22 11:07:38 2004
Subject: [Python.NET] Re: Problem whith DirectX Mesh importation
References:
Message-ID: <006b01c3e101$9945ef20$9a6d6150@pamtwo.com>
It seem that Mesh is in NameSpace 'CLR.Microsoft.DirectX.Direct3D' but is
define in the DLL : Microsoft.DirectX.Direct3DX.dll
so I try that:
a =
Assembly.LoadWithPartialName("C:\...\Microsoft.DirectX.Direct3DX.dll")
from CLR.Microsoft.DirectX.Direct3D import Mesh
But doesn't work.
If i well understand, 'from CLR.Microsoft.DirectX.Direct3D import Mesh' try
to import 'Mesh' from CLR.Microsoft.DirectX.Direct3D.dll not
CLR.Microsoft.DirectX.Direct3DX.dll , isn't it ?
The both dll share the same NameSpace.
----- Original Message -----
From: "Brian Lloyd"
To: "Laurent Caumont"
Cc:
Sent: Thursday, January 22, 2004 4:02 PM
Subject: RE: Problem whith DirectX Mesh importation
> > "from CLR.Microsoft.DirectX.Direct3D import Mesh"
> >
> > => ImportError: cannot import name Mesh
> >
> > It seems that 'Mesh' is define in the Direct3DX library because when I
> > remove the reference the "Microsoft.DirectX.Direct3DX" in the
> > reference list
> > in a directx C# sample, I have the same error...
> >
> > How can I add a refrence like in C# ?
> >
> > The "import CLR.Microsoft.DirectX.Direct3DX as D3DX" doesn't work.
> >
> > Thanks for help.
>
> What is the actual name of the _assembly_ that implements the
> Direct3DX library?
>
> Remember that the name-based import in Python is linked to
> namespaces, and 'implicit assembly loading' only happens if
> the namespace you are trying to import happens to match the
> name of the assembly implementing it (which luckily is often,
> but not always, the case).
>
> So for example, if the assembly is actually named 'Direct3DX.dll',
> you'll need to load the assembly explicitly before attempting to
> import the namespace, since the names don't match. There is an
> example of this in the README for Python for .NET:
>
> from CLR.System.Reflection import Assembly
>
> a = Assembly.LoadWithPartialName("SomeAssembly")
>
> # now we can import namespaces defined in that assembly
>
> from CLR.SomeNamespace import Something
>
>
>
>
>
> Brian Lloyd brian@zope.com
> V.P. Engineering 540.361.1716
> Zope Corporation http://www.zope.com
>
>
From brian at zope.com Thu Jan 22 11:13:43 2004
From: brian at zope.com (Brian Lloyd)
Date: Thu Jan 22 11:14:30 2004
Subject: [Python.NET] RE: Problem whith DirectX Mesh importation
In-Reply-To: <006b01c3e101$9945ef20$9a6d6150@pamtwo.com>
Message-ID:
> It seem that Mesh is in NameSpace 'CLR.Microsoft.DirectX.Direct3D' but is
> define in the DLL : Microsoft.DirectX.Direct3DX.dll
>
> so I try that:
> a =
> Assembly.LoadWithPartialName("C:\...\Microsoft.DirectX.Direct3DX.dll")
> from CLR.Microsoft.DirectX.Direct3D import Mesh
>
> But doesn't work.
I don't think that LoadWithPartialName wants a path. Try:
Assembly.LoadWithPartialName('Microsoft.DirectX.Direct3DX')
> If i well understand, 'from CLR.Microsoft.DirectX.Direct3D import
> Mesh' try
> to import 'Mesh' from CLR.Microsoft.DirectX.Direct3D.dll not
> CLR.Microsoft.DirectX.Direct3DX.dll , isn't it ?
>
> The both dll share the same NameSpace.
That shouldn't be a problem. The Python runtime can find objects
in different dlls that all live in the same namespace. The key
is making sure that you get the assembly loaded before trying
to do the import.
Brian Lloyd brian@zope.com
V.P. Engineering 540.361.1716
Zope Corporation http://www.zope.com
From lcaumont at pamdev.com Thu Jan 22 11:27:24 2004
From: lcaumont at pamdev.com (Laurent Caumont)
Date: Thu Jan 22 11:30:58 2004
Subject: [Python.NET] Re: Problem whith DirectX Mesh importation
References:
Message-ID: <007501c3e104$9e8263d0$9a6d6150@pamtwo.com>
Yes, you are Right !
That's work very well !
Thank you for all. :)
----- Original Message -----
From: "Brian Lloyd"
To: "Laurent Caumont"
Cc:
Sent: Thursday, January 22, 2004 5:13 PM
Subject: RE: Problem whith DirectX Mesh importation
> > It seem that Mesh is in NameSpace 'CLR.Microsoft.DirectX.Direct3D' but
is
> > define in the DLL : Microsoft.DirectX.Direct3DX.dll
> >
> > so I try that:
> > a =
> > Assembly.LoadWithPartialName("C:\...\Microsoft.DirectX.Direct3DX.dll")
> > from CLR.Microsoft.DirectX.Direct3D import Mesh
> >
> > But doesn't work.
>
> I don't think that LoadWithPartialName wants a path. Try:
>
> Assembly.LoadWithPartialName('Microsoft.DirectX.Direct3DX')
>
>
>
> > If i well understand, 'from CLR.Microsoft.DirectX.Direct3D import
> > Mesh' try
> > to import 'Mesh' from CLR.Microsoft.DirectX.Direct3D.dll not
> > CLR.Microsoft.DirectX.Direct3DX.dll , isn't it ?
> >
> > The both dll share the same NameSpace.
>
> That shouldn't be a problem. The Python runtime can find objects
> in different dlls that all live in the same namespace. The key
> is making sure that you get the assembly loaded before trying
> to do the import.
>
>
> Brian Lloyd brian@zope.com
> V.P. Engineering 540.361.1716
> Zope Corporation http://www.zope.com
>
>