.gh filepath python

Hi,

Isn’t there a way to get the .gh documents filepath?
I can only get the name of the file in my seachings.

Thanks in advance

You can call ghdoc.Path

1 Like

Ahhhh… That easy…
Is there any documentation that I could read for this issue to not ask this dumb questions again? =)

Not dumb at all, it can be quite confusing and opaque. You can read more on this topic here:

There’s also the very useful ghenv, you can read about that on the old forum here:

1 Like

Thanks a hundred times Anders!

1 Like

Hi again,

I have tried this out and also looked on other sides on the forum but can’t get it to work.
Why can’t I get the filepath to the document inside this cluster?

Thanks in advance

Because a cluster is a document within a document. I’d suggest to keep any document/path-related business at the top-level canvas of your Grasshopper definition.

Aha, ok.

But if I really need it to be inside the cluster, Isn’t that possible at all?

I’m sure it is. You can probably get the parent-document of a cluster and go from there. But afraid I can’t provide much insight there. I’d probably just get the path on the top-level, and then pass that to the cluster as an input variable.

Edit: Apologies, I totally forgot about this:

Hi Anders,

I did look into this link also, but inside the cluster running the script it give me a None value

I’m trying to within a cluster determine if the .gh file is placed in a specific networkspace. And if so it generates other variables to work with. And then I have a password for the cluster.
This way I at least get a little security on the .gh file even if I have understood that it’s quite easy for a person with knowhow to crack a password.

Yeah that was definitely a rather mysterious hack. Anywho, maybe have a look at DocumentServer:

That fixed the issue, thanks again Anders

1 Like