System.xml missing

Any idea why isn’t there System.XML?

The assembly is probably not referenced, you can add

import clr
clr.AddReference("System.Xml.dll")
import System.Xml as xml

Thanks @jesterking,

I know how to import an external dll, but why is it missing from ghpython? Is it a “bug”? I tested it with csharp and there it works fine.

Update:
Where are these dlls usually referenced from? Did I miss to install some dependency?

Off Topic: You are Nathan, right? Are you incognito? Why the different account? I’m just curious. :sweat_smile:

When people use (only) a signature you are not supposed to ask for their identity in public. PM is better if just curious.

// Rolf

When people don’t want their name revealed they wouldn’t put it in another very active (until recently) account.

Anyways, I accept the remark.

No worries guys, “the other account” is on vacation for the time being…

Yes. No. Vacation, as @wim mentioned. The other account has all bells and whistles enabled, this one is nice and quiet. Thursday I’ll (he’ll?) be back on the job.

2 Likes

Thanks for humoring me. Btw this was my first thought.

There are many assemblies not being able to be included directly in Python.
Could that be fixed, please?

The ones commented in the image below:

image

image

Is this LINQ thingy just generally forbidden to be used from IronPython?

Nevermind I guess I found partially the answer:

Still Some just can’t be added: :frowning:

image

image

Wrong reference:

import clr
clr.AddReference("System.Core.dll")
import System.Linq as linq
print(dir(linq))

More out of curiosity, what are you doing with LINQ that you can’t do with regular Python list comprehension (and/or itertools)?

I am trying to translate this script I found on the old forum, in order to learn how to do that, but for me csharp is very confusing at times.

GH.CreateCapsule.cs (4.4 KB)

This is my process of translation from csharp to python:

  • In order to figure out what I am supposed to do I try to import whatever is imported to the csharp
  • then start with the code by copying the classes methods you name it and searching the API about examples.
  • If no examples exist I’m trying to figure out myself how to declare those things in python because most of the time csharp syntax is madly uncomprehensible to me.

On top of all that I’m still a noob-programmer and there’s a lot of trial and error.

When it comes to a point that I cannot even import something the panic button is pushed :stuck_out_tongue_winking_eye:

On the other hand System.Xml.Linq is something I need for reading XMLs but I haven’t yet started playing with that.

Update:
@AndersDeleuran, btw I have no idea what LINQ does, I assume linking something, but I haven’t got to that yet. I’ll read about it when I get to it.

LOL how logical :smiley:

Thanks @jesterking

LINQ - language-integrated query

1 Like

For linq to xml check this LINQ to XML