Python.NET
Threads by month
- ----- 2024 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
April 2006
- 8 participants
- 12 discussions
Hi all,
I have installed pythonnet and thought it would be of interest
to send the outputs of the tests included in the library.
--
Jean Pierre
configuration
-----------------
Debian GNU/Linux 3.1
kernel 2.6
python-2.4.2
mono-1.1.13.4
pythonnet-1.0-rc2-py2.4-clr1.1
axtom:/opt/pythonnet# mono python.exe
Python 2.4.2 (#2, Apr 1 2006, 11:19:10)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/opt/pythonnet/src/tests')
>>> import runtests
>>> runtests.main()
..................F. test_exceptions
======================================================================
FAIL: Test the str() representation of an exception.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/pythonnet/src/tests/test_exceptions.py", line 310, in
testStrOfException
self.failUnless(str(e).find('at System.DateTime.Parse') > -1)
AssertionError
----------------------------------------------------------------------
Ran 20 tests in 0.271s
FAILED (failures=1)
.......F............ test_module
======================================================================
FAIL: Test implicit assembly loading via import.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/pythonnet/src/tests/test_module.py", line 177, in
testImplicitAssemblyLoad
self.failUnlessRaises(ImportError, test)
AssertionError: ImportError not raised
----------------------------------------------------------------------
Ran 20 tests in 0.127s
FAILED (failures=1)
.................... test_conversion
----------------------------------------------------------------------
Ran 20 tests in 0.054s
OK
............... test_class
----------------------------------------------------------------------
Ran 15 tests in 0.017s
OK
.... test_interface
----------------------------------------------------------------------
Ran 4 tests in 0.003s
OK
.....E......... test_enum
======================================================================
ERROR: Test enumeration conversion with FlagsAttribute set.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/pythonnet/src/tests/test_enum.py", line 130, in
testEnumWithFlagsAttrConversion
label = Label()
NullReferenceException: Object reference not set to an instance of an object
in <0x00013> System.Windows.Forms.Label:get_DefaultSize ()
in <0x001b3> System.Windows.Forms.Control:.ctor ()
in <0x0001b> System.Windows.Forms.Label:.ctor ()
in <0x00000> <unknown method>
in (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke
(object,object[])
in <0x0008d> System.Reflection.MonoCMethod:Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[]
parameters, System.Globalization.CultureInfo culture)
----------------------------------------------------------------------
Ran 15 tests in 0.099s
FAILED (errors=1)
.............................. test_field
----------------------------------------------------------------------
Ran 30 tests in 0.005s
OK
.......... test_property
----------------------------------------------------------------------
Ran 10 tests in 0.004s
OK
............................ test_indexer
----------------------------------------------------------------------
Ran 28 tests in 0.100s
OK
....................Mono System.Windows.Forms Assembly [Revision: 54007; built:
2005/12/6 14:35:24]
E....... test_event
======================================================================
ERROR: Test remove on an event sink implemented w/internalcall.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/pythonnet/src/tests/test_event.py", line 505, in
testRemoveInternalCallHandler
f = Form()
TypeInitializationException: An exception was thrown by the type initializer for
System.Windows.Forms.XplatUI
in <0x00000> <unknown method>
in <0x00064> System.Windows.Forms.Form:get_CreateParams ()
in <0x00273> System.Windows.Forms.Control:.ctor ()
in <0x00011> System.Windows.Forms.ScrollableControl:.ctor ()
in <0x00010> System.Windows.Forms.ContainerControl:.ctor ()
in <0x00019> System.Windows.Forms.Form:.ctor ()
in <0x00000> <unknown method>
in (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke
(object,object[])
in <0x0008d> System.Reflection.MonoCMethod:Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[]
parameters, System.Globalization.CultureInfo culture)
----------------------------------------------------------------------
Ran 28 tests in 0.180s
FAILED (errors=1)
.....................E..... test_method
======================================================================
ERROR: Test subclass instance conversion in method call.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/pythonnet/src/tests/test_method.py", line 235, in
testSubclassInstanceConversion
form = sub()
NullReferenceException: Object reference not set to an instance of an object
in <0x0001d> System.Windows.Forms.XplatUI:CalculateWindowRect (IntPtr handle,
System.Drawing.Rectangle ClientRect, Int32 Style, Int32 ExStyle,
System.Windows.Forms.Menu menu, System.Drawing.Rectangle WindowRect)
in <0x002b0> System.Windows.Forms.Control:.ctor ()
in <0x00011> System.Windows.Forms.ScrollableControl:.ctor ()
in <0x00010> System.Windows.Forms.ContainerControl:.ctor ()
in <0x00019> System.Windows.Forms.Form:.ctor ()
in <0x00000> <unknown method>
in (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke
(object,object[])
in <0x0008d> System.Reflection.MonoCMethod:Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[]
parameters, System.Globalization.CultureInfo culture)
----------------------------------------------------------------------
Ran 27 tests in 0.077s
FAILED (errors=1)
................ test_delegate
----------------------------------------------------------------------
Ran 16 tests in 0.006s
OK
....................................... test_array
----------------------------------------------------------------------
Ran 39 tests in 0.108s
OK
... test_thread
----------------------------------------------------------------------
Ran 3 tests in 1.112s
OK
... idem
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.098s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.098s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.100s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.098s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.098s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.129s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.100s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.098s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.100s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.098s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.098s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
...
----------------------------------------------------------------------
Ran 3 tests in 1.099s
OK
Total Time: 0.87
1
0
Hi looking for help with what should be a fairly simple Python problem,
relating to VB inter-operability.
Got a great response from a fellow named Matt at help(a)python.org,
pointed me in some good directions - some areas, concerns still foggy
on, the below thread is included.... any feedback on this simple dilemma
would be very appreciated.
Thanks,
D
thread follows below;
------------------------------------
To: help(a)python.org
Subject: Problem with Python math functions and VB
Date: 3/30/2006 9:39:28 PM
Download Message Display Headers Printer Friendly
Previous | Next
Wondering if you might either know how to solve the following.
I've a background in Visual Basic, and am using an old version, 4.0, it
compiles to a smaller executable which I prefer. I find myself in an odd
situation, needing a very simple yet powerful capability of Python for a
VB app
Im working on.
Simply, a large 300 digit number is divided by a smaller number ranging
from 1 to 3 digits. I.e;
This large 300 digit number is generated as a string from the VB app,
and I want to input this somehow
from the VB app directly to Python for simple math operations.
Where; x = 300 digit number, y = divisor ( say '37')
x / 37
I want to divide x by y but I want the remainder of this division to at
least 3 or 4 decimal places, so my Python script at the command line;
x %y /y. = z
So now I want to take the resultant, the full number plus its remainder,
and I want to round this number up
to the next highest number and divide it by the same constant;
z rounded up to next highest number (never the lowest)
so
z /y = z Long
Remove the 'L' at the end, round up the last digit of z = Z
Then;
Z %y /y. = a
Then I want the last five digits of z (not Z) and a truncated at the
end, so the last digit before
the decimal point and the four digits past the decimal point printed to
a text file.
I want to be able to open the text file with the VB app and use this
data as inputs.
==========
Ok, so here is my dilemma, I know VERY litle about Python and a fair bit
about VB.
Ideally, I'd love to be able to simply have some extremely small
executable that just accepts inputs
does the calculations above and then spits out the outputs. If it were
possible to write some
simple lines of math code in Python and then compile these scripts in
Python to a Windows
compatible executable,that would be fantastic.
If I could simply have my VB app, 'call' the name of the tiny Python
executable, and then the Python executable
just automatically looked for a named text file (created by the VB app)
and extracted the 300 digit number from this, then performed the calcs,
then spit this data out as a new text file name it created, which I
could then use the VB app to open and read from, THAT would be ideal.
However, I don't know if Python can compile scripts to an exe? If it can
how could I find out how to do this?
If it doesn't, how could I get VB to directly pass commands to the
Python command line and then automatically
extract the outputs? Shelling out from VB to Python would be tough to
the command line I think, since the Python command line uses the 'Edit /
Mark, Paste' approach to inserting, copy inputs, outputs and this would
be virtually untenable, as far as I can tell to automate in a VB shell
out routine.
So basically, how the heck can I access Pythons ability to perform
simple calculations on very large numbers, easily, from within VB 4.0 ?
There must be a way, it seems like such a simple think to do, especially
since the actual math operations are so simple, straight forward, and
would never change.....
Any ideas?
------
Matthew, thanks for your response.
<-----Original Message----->
>From: Matthew Dixon Cowles
>Sent: 3/31/2006 9:41:18 AM
>To: durango(a)mail2world.com
>Cc: help(a)python.org
>Subject: Re: [Python-Help] Problem with Python math functions and VB
>I'm sure that there's a way to do that, but I'm not familiar with
>Visual Basic and I don't know what inter-process communication
>facilities it offers.
Is there a person or group you might direct me to that has worked with
this
inter-process communication between VB and Python?
>I don't think that Python is going to be able to do that for you out
>of the box. Hundreds of digits of floating-point precision is a lot.
Could you explain that a bit more, sorry Im not sure what you mean
by 'out of the box' ? If I run the Python command line screen in windows
and manually type out a very large number, say 180 digits; where 'X' =
very large number;
X %37 /37.
returns what Im after, value wise..... but of course I don't want to do
this manually each time
for every dividend.
>You might find that one of the Python modules that let you use an
>extended-precision library would do what you want. GMPY is one:
>http://gmpy.sourceforge.net/
Hey, thats interesting, wonder if these modules can be operated on with
VB.....
>> So now I want to take the resultant, the full number plus its
>> remainder, and I want to round this number up
>> to the next highest number and divide it by the same constant;
>
>That's easy enough.
>
>> I want to be able to open the text file with the VB app and use this
>> data as inputs.
>
>Python can write to a file without any trouble, so it that form of
>inter-process communication suits you, you shouldn't have much
>trouble. I assume that Visual Basic has an easy way to start a
>program and supply it with arguments, so you could have your Python
>program get its inputs from sys.argv.
What is sys.argv ? Thats really good news. In fact, all I really need
for the moment is
a python executable that;
================
PYTHON ALGORITHM ABSTRACT
a) opens a text file
b) reads a string from the file, which is a very large number
c) performs simple arithmetic operations;
X %37 /37. = y (four digit remainder after decimal point)
X /37 = w (quotient as long, the resulting output is stored as a
variable, the 'L' suffix tagged on the end of this resultant then gets
removed.
then the last digit in the quotient resultant string is increased in
value by one, rounded upwards = 'Z'
then
Z %37 /37. = a
then, y and a are printed to a text file with hard returns between them.
Thats it, thats all I need to do.
===================
>Alas, it's not going to be extremely small. There isn't a compiler
>from Python to machine code. Py2exe will bundle a Python program,
>with everything that it needs to run, into a single executable
>archive. But the archive isn't small. Py2exe is at:
>
>http://www.py2exe.org/
the most important thing is the functionality, I'll sacrifice size if I
have to. My guess is this should work based on your comments, because
perhaps all I really have to do is have VB dump out the value of the
Very large number, `180 to 300 digits or so', to a text file, which then
becomes the input data for the Python executable, and then if I simply
call the name of the Python executable from VB as an instance,
then the Python App runs, spits out the data as a new text file, then
the VB app goes and opens the new text file and reads in the values,
and voila! There it is. I'm pretty sure I can call the Python app from
VB....... the alternative to all this would be to try and feed Python
scripts
directly to Python from VB, which I have NO idea how to do or where to
begin.... and am guessing would be much more messy...
I haven't programmed in Python, how would the "PYTHON ALGORITHM
ABSTRACT" I describe above look like, code wise?
Is this fairly easy for you to describe?
>It may be that Python isn't the best solution for you here. Are there
>extended-precision libraries for Visual Basic?
Alas, none that I know of that are reliable and not incredibly
expensive, been looking for years, plus Im hooped because I have to work
with VB 4.0 instead of 6 +, guh....
>Regards,
>Matt
Matt..... good name, why do I always seem to get along with Matts, you
people keep popping up in my life and its always a blast!
Best regards,
D
<span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR>Get the FREE email that has everyone talking at <a href=http://www.mail2world.com target=new>http://www.mail2world.com</a><br> <font color=#999999>Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More!</font></font></span>
1
0