You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@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 😸 )
Hi,
I just tried to install pythonnet from your develop branch. I used Anaconda
2.5 (Python 3.5.1) in combintation with Visual Studio Express 2015 and ran
python setup.py install
To get pythonnet running I had to manually copy all files from the
build/lib.win-amd64-3.5 folder to the anaconda install path.
Afterwards I was able to import clr.
The two demo files helloform.py and splitter.py seem to run correctly.
However, the file wordpad.py exits with the following error:
[Anaconda35] c:\JLINK_64\software\pythonnet-develop\demo>python wordpad.py
Traceback (most recent call last):
File "wordpad.py", line 430, in
main()
File "wordpad.py", line 425, in main
app = Wordpad()
File "wordpad.py", line 25, in init
self.InitializeComponent()
File "wordpad.py", line 208, in InitializeComponent
self.richTextBox.Font = System.Drawing.Font("Tahoma", 10)
TypeError: no constructor matches given arguments
Additionally I connected to the proprietary .NET API I used successfully
with python 3.4 and pythonnet. Here I get an error when running a function
which uses output variables. According to the C# API documentation the
function takes the following arguments:
bool ReadNextResult(
out int rayNumber,
out int errorCode,
out int vignetteCode,
out double X,
out double Y,
out double Z,
out double L,
out double M,
out double N,
out double opd,
out double l2,
out double m2,
out double n2,
out double intensity
)
With Python 3.4 and the pythonnet package from pypi, I was able to call
this function in the following way:
with Python 3.5 and the pythonnet version built from your develop branch I
get the following error:
Traceback (most recent call last):
File "", line 1, in
runfile('C:/JLINK_64/workspace/ZOS/PythonNet_ZOS_Raytrace.py',
wdir='C:/JLINK_64/workspace/ZOS')
File
"C:\JLINK_64\software\Anaconda35\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
line 699, in runfile
execfile(filename, namespace)
File
"C:\JLINK_64\software\Anaconda35\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "C:/JLINK_64/workspace/ZOS/PythonNet_ZOS_Raytrace.py", line 94, in
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:
Python 3.5.1 |Continuum Analytics, Inc.| (default, Jan 29 2016, 15:46:01) [MSC v
.1900 32 bit (Intel)] on win32
once you build the wheel and install it, copy Python.Test.dll to your ..\lib\site-packages folder and then run the tests from pythonnet source folder: python src\tests\runtests.py
i got the same error if I use wrong python version (2.7) to run wordpad.py, which suggests that you may have similar problem with activated conda environment, so try building debug version of pythonnet from VS2015 and see where pythonnet is loading from:
I could not reproduce your overloading problem with both static and instance methods:
with unbound methods (static):
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.
[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.
@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 python setup.py bdist_wheel
which gives the following output in the last line: creating build\bdist.win-amd64\wheel\pythonnet-2.1.0.dev1.dist-info\WHEEL
However, the folder build\bdist.win-amd64\ is empty.
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.
@denfromufa You are correct, I found the wheel in the .\dist folder.
From my perspective, it does not make sense to share the code which caused the overload error. It can only be used with the commercial program ZEMAX OpticStudio. This software requires a hardware dongle and the source code of the API is not publicly available.
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.
Activity
brisingraerowing commentedon Sep 20, 2015
I'd like this as well.
brisingraerowing commentedon Sep 20, 2015
I just submitted a pull request with initial Python 3.5 support.
fdanny commentedon Oct 1, 2015
Did the pull request #104 go thru? Can we close this issue?
vmuriart commentedon Oct 16, 2015
The pull request seems to have been closed without merging.
mahibra commentedon Jan 18, 2016
Any news on the python 3.5 support? I would love to use Python.NET with the current Python version.
den-run-ai commentedon Jan 27, 2016
Very weird - that pull request points to an unknown branch
den-run-ai commentedon Jan 27, 2016
There is a blog post about 3.5:
http://www.xavierdupre.fr/app/pymyinstall/helpsphinx/blog/2016/2016-01-03_pythonnet.html
den-run-ai commentedon Jan 27, 2016
Looks like this branch can be merged:
https://github.com/sdpython/pythonnet3
vmuriart commentedon Jan 28, 2016
From reading the blog it seems that it still has a few issues to resolve
On Wednesday, January 27, 2016, denfromufa [email protected] wrote:
vmuriart commentedon Feb 4, 2016
@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 😸 )
tonyroberts commentedon Feb 4, 2016
@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.
den-run-ai commentedon Feb 16, 2016
@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.
mahibra commentedon Feb 17, 2016
Hi,
I just tried to install pythonnet from your develop branch. I used Anaconda
2.5 (Python 3.5.1) in combintation with Visual Studio Express 2015 and ran
To get pythonnet running I had to manually copy all files from the
build/lib.win-amd64-3.5 folder to the anaconda install path.
Afterwards I was able to import clr.
The two demo files helloform.py and splitter.py seem to run correctly.
However, the file wordpad.py exits with the following error:
[Anaconda35] c:\JLINK_64\software\pythonnet-develop\demo>python wordpad.py
Traceback (most recent call last):
File "wordpad.py", line 430, in
main()
File "wordpad.py", line 425, in main
app = Wordpad()
File "wordpad.py", line 25, in init
self.InitializeComponent()
File "wordpad.py", line 208, in InitializeComponent
self.richTextBox.Font = System.Drawing.Font("Tahoma", 10)
TypeError: no constructor matches given arguments
Additionally I connected to the proprietary .NET API I used successfully
with python 3.4 and pythonnet. Here I get an error when running a function
which uses output variables. According to the C# API documentation the
function takes the following arguments:
bool ReadNextResult(
out int rayNumber,
out int errorCode,
out int vignetteCode,
out double X,
out double Y,
out double Z,
out double L,
out double M,
out double N,
out double opd,
out double l2,
out double m2,
out double n2,
out double intensity
)
With Python 3.4 and the pythonnet package from pypi, I was able to call
this function in the following way:
out = BatchRayTrace.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)with Python 3.5 and the pythonnet version built from your develop branch I
get the following error:
Traceback (most recent call last):
File "", line 1, in
runfile('C:/JLINK_64/workspace/ZOS/PythonNet_ZOS_Raytrace.py',
wdir='C:/JLINK_64/workspace/ZOS')
File
"C:\JLINK_64\software\Anaconda35\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
line 699, in runfile
execfile(filename, namespace)
File
"C:\JLINK_64\software\Anaconda35\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "C:/JLINK_64/workspace/ZOS/PythonNet_ZOS_Raytrace.py", line 94, in
results = batchRayTrace.ReadNextResult(*dummyInput)
TypeError: No method matches given arguments
Running BatchRayTrace.ReadNextResult? in IPython gives:
batchRayTrace.ReadNextResult?
Type: MethodBinding
String form: <bound method 'ReadNextResult'>
File:
c:\jlink_64\software\anaconda35\lib\site-packages\pythonnet-2.1.0.dev1-py3.5-win-amd64.egg\clr.pyd
Docstring:
Boolean ReadNextResult(Int32 ByRef, Int32 ByRef, Int32 ByRef, Int32 ByRef)
Boolean ReadNextResult(Int32 ByRef, Int32 ByRef, Double ByRef, Double
ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef)
Boolean ReadNextResult(Int32 ByRef, Int32 ByRef, Int32 ByRef, Double ByRef,
Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef,
Double ByRef)
Boolean ReadNextResult(Int32 ByRef, Int32 ByRef, Int32 ByRef, Double ByRef,
Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef,
Double ByRef, Double ByRef, Double ByRef, Double ByRef)
Boolean ReadNextResult(Int32 ByRef, Int32 ByRef, Int32 ByRef, Double ByRef,
Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef,
Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef)
Do you have an explanation for this error and can you give me instructions
on how it could be fixed?
Thank you very much!
Best regards,
Matthias
den-run-ai commentedon Feb 18, 2016
@mahibra can you edit your comment with code blocks according to github markdown:
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
den-run-ai commentedon Feb 18, 2016
python setup.py installis not supported, instead first you need to build awheeland then install it e.g. usingpip.#123
den-run-ai commentedon Feb 18, 2016
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
Python.Test.dllto your..\lib\site-packagesfolder and then run the tests from pythonnet source folder:python src\tests\runtests.pyden-run-ai commentedon Feb 18, 2016
i got the same error if I use wrong python version (2.7) to run
wordpad.py, which suggests that you may have similar problem with activated conda environment, so try building debug version of pythonnet from VS2015 and see where pythonnet is loading from:and failing case due to my stupid mistake:
den-run-ai commentedon Feb 18, 2016
regarding your overloading failure, this is most likely due to this commit, so try the develop branch before that merge:
#151
den-run-ai commentedon Feb 18, 2016
I could not reproduce your overloading problem with both static and instance methods:
C# code for both classes:
mahibra commentedon Feb 18, 2016
@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
python setup.py bdist_wheelwhich gives the following output in the last line:
creating build\bdist.win-amd64\wheel\pythonnet-2.1.0.dev1.dist-info\WHEELHowever, the folder
build\bdist.win-amd64\is empty.I also tried to use code blocks in yesterday's messge which does not work while this comment is formatted correctly.
den-run-ai commentedon Feb 18, 2016
@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.
den-run-ai commentedon Feb 18, 2016
@mahibra once you build the wheel, its location is
.\distfolder, not the.\buildfolder.mahibra commentedon Feb 18, 2016
@denfromufa You are correct, I found the wheel in the .\dist folder.
From my perspective, it does not make sense to share the code which caused the overload error. It can only be used with the commercial program ZEMAX OpticStudio. This software requires a hardware dongle and the source code of the API is not publicly available.
Interesingly, I found a similar overloaded method in the same API which works with the newer version of methodbinder.cs.
tonyroberts commentedon Feb 24, 2016
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.
vmuriart commentedon Feb 24, 2016
@tonyroberts sweet. Thanks for getting this closed.
Just looked over the code, I didn't see where you are specifying which Interop to be used.
Were you still planning on releasing 2.1 and updating the master branch?