System.xml missing

unhandled

(IVELIN PEYCHEV) #1

Any idea why isn’t there System.XML?


(jesterKing) #2

The assembly is probably not referenced, you can add

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

(IVELIN PEYCHEV) #3

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:


#4

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

// Rolf


(IVELIN PEYCHEV) #5

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.


#6

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


(jesterKing) #7

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.


(IVELIN PEYCHEV) #8

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


(IVELIN PEYCHEV) #9

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?


(IVELIN PEYCHEV) #10

Nevermind I guess I found partially the answer:


(IVELIN PEYCHEV) #11

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

image

image


(jesterKing) #12

Wrong reference:

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

#13

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


(IVELIN PEYCHEV) #14

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.


(IVELIN PEYCHEV) #15

LOL how logical :smiley:

Thanks @jesterking


(Michael Pryor) #16

LINQ - language-integrated query