Re: Python in Blender. Writing information to a file.

2019-08-09 Thread Cameron Simpson
On 09Aug2019 20:53, Paul St George wrote: I almost understand. Are you saying I should change the first line of code to something like: |outstream = with open(path to my file,'w') # this is invalid syntax| and then delete the outstream.close() No, you should do what Peter wrote: with

Re: Re: Python in Blender. Writing information to a file.

2019-08-09 Thread Paul St George
On 09/08/2019 15:59, Rhodri James wrote: On 09/08/2019 14:54, Paul St George wrote: On 09/08/2019 04:09, Cameron Simpson wrote: On 08Aug2019 22:42, Paul St George wrote: On 08/08/2019 10:18, Peter Otten wrote: The print() function has a keyword-only file argument. So: with open(..., "w")

Re: Python in Blender. Writing information to a file.

2019-08-09 Thread Rhodri James
On 09/08/2019 14:54, Paul St George wrote: On 09/08/2019 04:09, Cameron Simpson wrote: On 08Aug2019 22:42, Paul St George wrote: On 08/08/2019 10:18, Peter Otten wrote: The print() function has a keyword-only file argument. So: with open(..., "w") as outstream:     print("Focal length:",

Re: Python in Blender. Writing information to a file.

2019-08-09 Thread Paul St George
On 09/08/2019 04:09, Cameron Simpson wrote: On 08Aug2019 22:42, Paul St George wrote: On 08/08/2019 10:18, Peter Otten wrote: The print() function has a keyword-only file argument. So: with open(..., "w") as outstream:     print("Focal length:", bpy.context.object.data.lens, file=outstream)

Re: Python in Blender. Writing information to a file.

2019-08-08 Thread Cameron Simpson
On 08Aug2019 22:42, Paul St George wrote: On 08/08/2019 10:18, Peter Otten wrote: The print() function has a keyword-only file argument. So: with open(..., "w") as outstream: print("Focal length:", bpy.context.object.data.lens, file=outstream) [...] That worked perfectly. outstream =

Re: Re: Python in Blender. Writing information to a file.

2019-08-08 Thread Paul St George
On 08/08/2019 10:18, Peter Otten wrote: Paul St George wrote: I am using Python 3.5 within Blender. I want to collect values of the current settings and then write all the results to a file. I can see the settings and the values in the Python console by doing this for each of the settings |

Re: Python in Blender. Writing information to a file.

2019-08-08 Thread Peter Otten
Paul St George wrote: > I am using Python 3.5 within Blender. I want to collect values of the > current settings and then write all the results to a file. > > I can see the settings and the values in the Python console by doing > this for each of the settings > | > | > > |print(“Focal

Python in Blender. Writing information to a file.

2019-08-08 Thread Paul St George
I am using Python 3.5 within Blender. I want to collect values of the current settings and then write all the results to a file. I can see the settings and the values in the Python console by doing this for each of the settings | | |print(“Focal length:”,bpy.context.object.data.lens)|