Grasshopper

algorithmic modeling for Rhino

Here is some IronPy problem I'm trying to fight with.

As far as I know this exception is basically the same one as one gets whenever there are 2 instances of the same assembly loaded, and the types from one cannot be used with the other. 

I'm attaching both .net libraries here as well.

The Owl.GH.Common is referencing the Owl.Core, and I've double-checked the project setup not to CopyLocal the files as this sometimes was the reason of a similar error seen in .NET code.

Views: 1411

Attachments:

Replies to This Discussion

I do not get any error

Maybe you have referenced paths elsewhere for  two copies of the same dll such as python editor?

Maybe you could solve my issue?

http://www.grasshopper3d.com/forum/topics/texture-mapping-surfaces

Hm, your response gives me some idea I'll try out in a second. 

In the meantime - take a look at your issue again.

EDIT: 

Ok, I think I should add this: Both the Owl.Core.dll and Owl.GH.Common.dll are loaded by GH through the Owl.GH.gha plugin. If I disable the Owl plugin, the Py script works as it should.

Ok, tried it and it seems to work. 

It would be cool to get some help on how the referencing mechanism works... 

Not sure that this will help, but you probably want to use clr.addreferencetofileandpath() when targeting a full path like that (and use double backslash instead of forward slash, if I recall correctly. Edit: and add the extension).

Unfortunately not, tried it already...

Seems to work on my system. Sounds like you might be referencing a stray/wrong assembly like Tom said (likely caused by the ambiguous reference method):

I'm surprised that your referencing is even working, here's what I would expect:

Edit: Using your referencing code I can reproduce your error, looks like you didn't try hard enough :D



Attachments:

It works for me that way as well (without the gha loaded), but I need both: the gha loaded by GH AND the dlls loaded by the py script component... I'm guessing you don't have the Owl plugin.

EDIT: will try your ways anyway later... 

EDIT2: another issue is that once you load the .net libraries, you can't unload them by any way without ending the process... hence the debugging is quite painful in this case.

Ok so it works, the issue is with the way I write the file paths. 

If I'm using "/", the library is loaded, but then the ArgumentTypeException error occurs. 

BUT

If I'm using "\\" in the path, it works just as it should. 

Can we call it a bug, or am I missing something from the clr documentation ? 

I think so. I know that a single forward slash "should" work on Windows, but this does demonstrate that something might be fucky! As far as I recall you can use os.path.normpath() to normalise paths such that they "should" work within the environment the code is executed. Or, just use two backslashes in the first place.


RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service