-
Notifications
You must be signed in to change notification settings - Fork 748
Python 3.5 support #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'd like this as well. |
I just submitted a pull request with initial Python 3.5 support. |
Did the pull request #104 go thru? Can we close this issue? |
The pull request seems to have been closed without merging. |
Any news on the python 3.5 support? I would love to use Python.NET with the current Python version. |
Very weird - that pull request points to an unknown branch |
There is a blog post about 3.5: |
Looks like this branch can be merged: |
From reading the blog it seems that it still has a few issues to resolve On Wednesday, January 27, 2016, denfromufa notifications@github.com wrote:
|
@denfromufa I'd like to withdraw my earlier statement, I reread the blog and looks like I misunderstood the issue. He had a built issue that he mentioned. I took a look at the src and compared it to the earlier pr that was submitted. sdpython's looks alot more complete as it integrates the new 3.5 features. @tonyroberts any reason this can't be merged (other than no existing pull request 😸 ) |
@vmuriart would be great if you could test and create a PR. Please make sure you add 3.5 builds to the travis and appveyor CI builds. |
@fdanny @mahibra @brisingraerowing try this branch until it is merged: https://github.com/denfromufa/pythonnet/tree/develop only one very weird test case is failing on travis ci, hence I commented out it for now. appveyor needs some updates for python 3.5, but I tested locally on my windows 7 machine. |
Hi,
To get pythonnet running I had to manually copy all files from the The two demo files helloform.py and splitter.py seem to run correctly. [Anaconda35] c:\JLINK_64\software\pythonnet-develop\demo>python wordpad.py Additionally I connected to the proprietary .NET API I used successfully bool ReadNextResult( With Python 3.4 and the pythonnet package from pypi, I was able to call
with Python 3.5 and the pythonnet version built from your develop branch I Traceback (most recent call last): File "", line 1, in File File File "C:/JLINK_64/workspace/ZOS/PythonNet_ZOS_Raytrace.py", line 94, in TypeError: No method matches given arguments Running BatchRayTrace.ReadNextResult? in IPython gives: Do you have an explanation for this error and can you give me instructions Thank you very much! Best regards, |
@mahibra can you edit your comment with code blocks according to github markdown: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code |
|
all 3 demos work on python 3.5, 32bit, perhaps this is specific to 64bit python or your installation. The appveyor CI is not failing on 64bit python 3.5 for the tests. the demos are not setup for testing on appveyor. Here is python 3.5 I tested this on locally:
once you build the wheel and install it, copy |
i got the same error if I use wrong python version (2.7) to run [py35] C:\pythonnet\pythonnet35\demo>python helloform.py
Attempting to load Python.Runtime using standard binding rules...
Attempting to load Python.Runtime from: 'C:\Python\Python27\envs\py35\lib\site-p
ackages\Python.Runtime.dll'...
C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b7
7a5c561934e089\System.Windows.Forms.dll
form created
app referenced and failing case due to my stupid mistake: [py35] C:\pythonnet\pythonnet35\demo>wordpad.py
Attempting to load Python.Runtime using standard binding rules...
Attempting to load Python.Runtime from: 'C:\Python\Python27\lib\site-packages\Py
thon.Runtime.dll'...
Traceback (most recent call last):
File "C:\pythonnet\pythonnet35\demo\wordpad.py", line 430, in <module>
main()
File "C:\pythonnet\pythonnet35\demo\wordpad.py", line 425, in main
app = Wordpad()
File "C:\pythonnet\pythonnet35\demo\wordpad.py", line 25, in __init__
self.InitializeComponent()
File "C:\pythonnet\pythonnet35\demo\wordpad.py", line 208, in InitializeCompon
ent
self.richTextBox.Font = System.Drawing.Font("Tahoma", 10)
TypeError: no constructor matches given arguments
[py35] C:\pythonnet\pythonnet35\demo>python splitter.py
Attempting to load Python.Runtime using standard binding rules...
Attempting to load Python.Runtime from: 'C:\Python\Python27\envs\py35\lib\site-p
ackages\Python.Runtime.dll'... |
regarding your overloading failure, this is most likely due to this commit, so try the develop branch before that merge: |
I could not reproduce your overloading problem with both static and instance methods:
C:\Python\Python27_64b>Scripts\activate.bat py35
Activating environment "C:\Python\Python27_64b\envs\py35"...
[py35] C:\Python\Python27_64b>cd env
The system cannot find the path specified.
[py35] C:\Python\Python27_64b>cd envs
[py35] C:\Python\Python27_64b\envs>cd py35
[py35] C:\Python\Python27_64b\envs\py35>python
Python 3.5.1 |Continuum Analytics, Inc.| (default, Jan 29 2016, 15:01:46) [MSC v
.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information. >>> import clr
>>> clr.AddReference(r"C:\Users\denis.akhiyarov\Documents\visual studio 2015\Pro
jects\ClassLibrary2\ClassLibrary2\bin\Debug\ClassLibrary2.dll")
<System.Reflection.RuntimeAssembly object at 0x0000000002DD5390>
>>> import ClassLibrary2
>>> import ClassLibrary2 as cl2
>>> dir(cl2)
['Class1', '__class__', '__delattr__', '__delete__', '__dir__', '__doc__', '__eq
__', '__file__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__
', '__init__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__'
, '__reduce__', '__reduce_ex__', '__repr__', '__set__', '__setattr__', '__sizeof
__', '__str__', '__subclasshook__']
>>> dir(cl2.Class1)
['Equals', 'Finalize', 'GetHashCode', 'GetType', 'MemberwiseClone', 'Overloads',
'ReadNextResult', 'ReferenceEquals', 'ToString', '__call__', '__class__', '__de
lattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__',
'__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__'
, '__le__', '__lt__', '__module__', '__ne__', '__new__', '__overloads__', '__red
uce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__',
'__str__', '__subclasshook__']
>>> cl2.Class1.Overloads
ClassLibrary2.Class1()
>>> cl2.Class1.ReadNextResult
<unbound method 'ReadNextResult'>
>>> cl2.Class1.ReadNextResult(0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
... 0.0, 0.0, 0.0, 0.0, 0.0)
14
>>> import clr
>>> clr.AddReference(r"C:\Users\denis.akhiyarov\Documents\visual studio 2015\Pro
jects\ClassLibrary2\ClassLibrary1\bin\Debug\ClassLibrary1.dll")
<System.Reflection.RuntimeAssembly object at 0x0000000002CA5390>
>>> import ClassLibrary1 as cl1
>>> dir(cl2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'cl2' is not defined
>>> dir(cl1)
['Class1', '__class__', '__delattr__', '__delete__', '__dir__', '__doc__', '__eq
__', '__file__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__
', '__init__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__'
, '__reduce__', '__reduce_ex__', '__repr__', '__set__', '__setattr__', '__sizeof
__', '__str__', '__subclasshook__']
>>> dir(cl1.Class1)
['Equals', 'Finalize', 'GetHashCode', 'GetType', 'MemberwiseClone', 'Overloads',
'ReadNextResult', 'ReferenceEquals', 'ToString', '__call__', '__class__', '__de
lattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__',
'__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__'
, '__le__', '__lt__', '__module__', '__ne__', '__new__', '__overloads__', '__red
uce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__',
'__str__', '__subclasshook__']
>>> cl2.Class1.ReadNextResult
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'cl2' is not defined
>>> cl1.Class1.ReadNextResult
<unbound method 'ReadNextResult'>
>>> cl1inst = cl1.Class1()
>>> cl1inst.ReadNextResult
<bound method 'ReadNextResult'>
>>> cl1inst.ReadNextResult(0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
... 0.0, 0.0, 0.0, 0.0, 0.0)
14 C# code for both classes: using System;
namespace ClassLibrary1
{
public class Class1
{
public Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Int32 ByRef3, Int32 ByRef4)
{
return 4;
}
public Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Double ByRef3, Double
ByRef4, Double ByRef5, Double ByRef6, Double ByRef7, Double ByRef8, Double ByRef9)
{
return 9;
}
public Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Int32 ByRef3, Double ByRef4,
Double ByRef5, Double ByRef6, Double ByRef7, Double ByRef8, Double ByRef9,
Double ByRef10)
{
return 10;
}
public Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Int32 ByRef3, Double ByRef4,
Double ByRef5, Double ByRef6, Double ByRef7, Double ByRef8, Double ByRef9,
Double ByRef10, Double ByRef11, Double ByRef12, Double ByRef13)
{
return 13;
}
public Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Int32 ByRef3, Double ByRef4,
Double ByRef5, Double ByRef6, Double ByRef7, Double ByRef8, Double ByRef9,
Double ByRef10, Double ByRef11, Double ByRef12, Double ByRef13, Double ByRef14)
{
return 14;
}
}
}
using System;
namespace ClassLibrary2
{
public class Class1
{
public static Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Int32 ByRef3, Int32 ByRef4)
{
return 4;
}
public static Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Double ByRef3, Double
ByRef4, Double ByRef5, Double ByRef6, Double ByRef7, Double ByRef8, Double ByRef9)
{
return 9;
}
public static Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Int32 ByRef3, Double ByRef4,
Double ByRef5, Double ByRef6, Double ByRef7, Double ByRef8, Double ByRef9,
Double ByRef10)
{
return 10;
}
public static Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Int32 ByRef3, Double ByRef4,
Double ByRef5, Double ByRef6, Double ByRef7, Double ByRef8, Double ByRef9,
Double ByRef10, Double ByRef11, Double ByRef12, Double ByRef13)
{
return 13;
}
public static Int32 ReadNextResult(Int32 ByRef1, Int32 ByRef2, Int32 ByRef3, Double ByRef4,
Double ByRef5, Double ByRef6, Double ByRef7, Double ByRef8, Double ByRef9,
Double ByRef10, Double ByRef11, Double ByRef12, Double ByRef13, Double ByRef14)
{
return 14;
}
}
}
|
@denfromufa Thank you very much for the instantaneous help! Replacing methodbinder.cs with the state before commit #151 fixed both my issues with the third party API and with the wordpad.py demo file. I tried to build a wheel by running I also tried to use code blocks in yesterday's messge which does not work while this comment is formatted correctly. |
@mahibra I'm glad that your overloading problem is resolved, although temporarily. Can you share the complete code that can be reproduced to fix this overloading exception? As you can see above - my c# snippet does not reproduce this problem. wordpad.py should not be affected by my commit #151 at all. I could NOT reproduce this problem with both python 3.5 32bit & 64bit on my latest develop branch. |
@mahibra once you build the wheel, its location is |
@denfromufa You are correct, I found the wheel in the .\dist folder. Interesingly, I found a similar overloaded method in the same API which works with the newer version of methodbinder.cs. |
This is now done. @denfromufa @vmuriart see PR 163 for details. Note that unlike the previous attempts this builds the TypeOffset class from the python headers, and so the order of the struct members is now correct (in the previous PRs there seemed to be a lot of confusion and errors in that area). For the most usual Python configurations I've checked in the auto generated code, but if you are using something else (e.g. Python built with Py_DEBUG) then setup.py will attempt to generate the correct class, which requires clang to be installed. All tests are passing without modification. |
@tonyroberts sweet. Thanks for getting this closed. Were you still planning on releasing 2.1 and updating the master branch? |
Python 3.5 support pythonnet. It supports up to 3.4.
The text was updated successfully, but these errors were encountered: