Hi William,
I am trying to understand what you are doing.
Interfering means that either one of the cube or the file does not work ?
what's your seen behaviour ?
I am not used to path or file but I believe it should be the
current name of the script, but this does not exist.
The used python script in openscad is just a string and does not have a
filename(python does not know the path of your editor console)
Did you intend to write new content to the script file while you execute it
?
Cheers
On Wed, Sep 6, 2023 at 4:28 AM William F. Adams via Discuss <
discuss@lists.openscad.org> wrote:
---------- Forwarded message ----------
From: "William F. Adams" willadams@aol.com
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Wed, 6 Sep 2023 02:28:18 +0000 (UTC)
Subject: [OpenSCAD] Re: The nature of Python in OpenSCAD and future
plans/features
Experimenting a bit more, the following sort of worked:
import os
h = 1
w = 2
d = 3
fn = os.path.basename(name)
string = ("cube" + str(w) + str(d) + str(h))
f = open(fn, "a")
f.write(string)
cube([w,d,h]).output()
f.close()
but I'm still mystified as to why:
fn = os.path.basename(file)
didn't work.
---------- Forwarded message ----------
From: "William F. Adams via Discuss" discuss@lists.openscad.org
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc: "William F. Adams" willadams@aol.com
Bcc:
Date: Wed, 6 Sep 2023 02:28:18 +0000 (UTC)
Subject: [OpenSCAD] Re: The nature of Python in OpenSCAD and future
plans/features
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Guenther Sohler guenther.sohler@gmail.com wrote:
Interfering means that either one of the cube or the file does not work ? >what's your seen behaviour ?
Execution en toto was blocked by the error.
I am not used to path or file but I believe it should >be the current name of the script, but this does not exist.
Correct, OIC.
The used python script in openscad is just a string and >does not have a filename(python does not know the path of your editor console)
Oh.
Did you intend to write new content to the script file while you execute it ?
Yes. I wanted to write out a file which has the same name, but a different file extension.
I'm looking at your other mail and will see what I can puzzle out.
William