Re: absolute path to a file

2019-08-21 Thread tom arnall
Thanks. Hope you found a solution to the problem. On Tue, Aug 20, 2019, 2:51 AM Cameron Simpson wrote: > Please remember to CC the list. > > On 19Aug2019 22:06, Paul St George wrote: > >On 19/08/2019 14:16, Cameron Simpson wrote: > [...] > >>There's a remark on that web page I mentioned that

Re: absolute path to a file

2019-08-21 Thread Paul St George
On 21/08/2019 04:09, Grant Edwards wrote: On 2019-08-21, Richard Damon wrote: I think gmane feed the newsgroup comp.lang.python which feeds python-list@python.org. No, gmane is a gateway to python-list@python.org. -- Grant I use https://mail.python.org/pipermail/python-list/ to confirm

Re: absolute path to a file

2019-08-20 Thread Grant Edwards
On 2019-08-21, Richard Damon wrote: > I think gmane feed the newsgroup comp.lang.python which feeds > python-list@python.org. No, gmane is a gateway to python-list@python.org. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: absolute path to a file

2019-08-20 Thread Richard Damon
On 8/20/19 5:56 PM, Cameron Simpson wrote: > > Hmm. I've been getting some of your posts directly to me as email with > no obvious python-list@python.org to/cc header. Maybe some interaction > with gmane? If you've been posting to the gmane newsgroup and CCing me > privately that is likely fine,

Re: absolute path to a file

2019-08-20 Thread Cameron Simpson
On 20Aug2019 21:06, Paul St George wrote: On 20/08/2019 11:43, Cameron Simpson wrote: Please remember to CC the list. Instead of 'Post a followup to this newsgroup' or 'To: python-list@python.org'? Hmm. I've been getting some of your posts directly to me as email with no obvious

Re: absolute path to a file

2019-08-20 Thread Paul St George
On 20/08/2019 11:43, Cameron Simpson wrote: Please remember to CC the list. Instead of 'Post a followup to this newsgroup' or 'To: python-list@python.org'? On 19Aug2019 22:06, Paul St George wrote: On 19/08/2019 14:16, Cameron Simpson wrote: [...] There's a remark on that web page I

Re: absolute path to a file

2019-08-20 Thread Cameron Simpson
Please remember to CC the list. On 19Aug2019 22:06, Paul St George wrote: On 19/08/2019 14:16, Cameron Simpson wrote: [...] There's a remark on that web page I mentioned that suggests that the leading '//' indicates the filename is relative to the Blender model, so the context directory for

Re: absolute path to a file

2019-08-19 Thread Paul St George
On 19/08/2019 14:16, Cameron Simpson wrote: On 19Aug2019 08:52, Paul St George wrote: On 19/08/2019 01:31, Cameron Simpson wrote: On 18Aug2019 17:29, Paul St George wrote: On 18/08/2019 02:03, Cameron Simpson wrote: 1: Is image01.tif a real existing file when you ran this code? Yes.

Re: absolute path to a file

2019-08-19 Thread Cameron Simpson
On 19Aug2019 08:52, Paul St George wrote: On 19/08/2019 01:31, Cameron Simpson wrote: On 18Aug2019 17:29, Paul St George wrote: On 18/08/2019 02:03, Cameron Simpson wrote: 1: Is image01.tif a real existing file when you ran this code? Yes. image01.tif is real, existing and apparent. But in

Re: absolute path to a file

2019-08-19 Thread Paul St George
On 19/08/2019 01:31, Cameron Simpson wrote: Paul, I can see we must train you in the interleaved response style :-) On 18Aug2019 17:29, Paul St George wrote: On 18/08/2019 02:03, Cameron Simpson wrote: 1: Is image01.tif a real existing file when you ran this code? Yes. image01.tif is real,

Re: absolute path to a file

2019-08-18 Thread Cameron Simpson
Paul, I can see we must train you in the interleaved response style :-) On 18Aug2019 17:29, Paul St George wrote: On 18/08/2019 02:03, Cameron Simpson wrote: 1: Is image01.tif a real existing file when you ran this code? Yes. image01.tif is real, existing and apparent. But in what

Re: absolute path to a file

2019-08-18 Thread Paul St George
On 18/08/2019 02:03, Cameron Simpson wrote: On 17Aug2019 11:51, Paul St George wrote: print('Track D  from Track B:',os.path.realpath(n.image.filepath)) ---Track D  from Track B: /image01.tif print('Track E  from Track B:',os.path.realpath(n.image.filepath[1:])) ---Track E  from Track B:

Re: absolute path to a file

2019-08-17 Thread Cameron Simpson
On 17Aug2019 11:51, Paul St George wrote: print('Track D from Track B:',os.path.realpath(n.image.filepath)) ---Track D from Track B: /image01.tif print('Track E from Track B:',os.path.realpath(n.image.filepath[1:])) ---Track E from Track B: /image01.tif print('Track F from Track

Re: absolute path to a file

2019-08-17 Thread Paul St George
On 17/08/2019 15:37, Peter Otten wrote: Paul St George wrote: Can someone please tell me how to get the absolute path to a file? I have tried os.path.abspath. In the code below I have a problem in the final line (15). # |import bpy|| Is this blender? If so the "//" prefix starts making

Re: absolute path to a file

2019-08-17 Thread Richard Damon
On 8/17/19 10:21 AM, Paul St George wrote: > Yes, it is Blender and the bpy.path.abspath() works! > And thank you also for the link to the docs. They say: > Returns the absolute path relative to the current blend file using the > “//” prefix. > > So does Blender have its own Python??? I don't

Re: absolute path to a file

2019-08-17 Thread Paul St George
On 17/08/2019 16:32, Dennis Lee Bieber wrote: On Sat, 17 Aug 2019 11:51:47 +0200, Paul St George declaimed the following: print('Track E from Track B:',os.path.realpath(n.image.filepath[1:])) ---Track E from Track B: /image01.tif Just for giggles, what happens if you preface

Re: absolute path to a file

2019-08-17 Thread Paul St George
On 17/08/2019 15:37, Peter Otten wrote: Paul St George wrote: Can someone please tell me how to get the absolute path to a file? I have tried os.path.abspath. In the code below I have a problem in the final line (15). # |import bpy|| Is this blender? If so the "//" prefix starts making

Re: absolute path to a file

2019-08-17 Thread Peter Otten
Paul St George wrote: > Can someone please tell me how to get the absolute path to a file? I > have tried os.path.abspath. In the code below I have a problem in the > final line (15). > > # > |import bpy|| Is this blender? If so the "//" prefix starts making sense:

Re: absolute path to a file

2019-08-17 Thread Manfred Lotz
Hi Paul, Here an example how I used both functions https://gitlab.com/snippets/1886520 Hope this helps. -- Manfred -- https://mail.python.org/mailman/listinfo/python-list

Re: absolute path to a file

2019-08-17 Thread Paul St George
On 17/08/2019 01:07, Gregory Ewing wrote: On Sat, Aug 17, 2019 at 2:27 AM Paul St George wrote: BUT does not work with | print('test2:',os.path.realpath(n.image.filepath))| This returns only |/image01.tif| What does n.image.filepath look like on its own? If it starts with a leading slash,

Re: absolute path to a file

2019-08-16 Thread Gregory Ewing
On Sat, Aug 17, 2019 at 2:27 AM Paul St George wrote: BUT does not work with | print('test2:',os.path.realpath(n.image.filepath))| This returns only |/image01.tif| What does n.image.filepath look like on its own? If it starts with a leading slash, then os.path.realpath will think it's

Re: absolute path to a file

2019-08-16 Thread Chris Angelico
On Sat, Aug 17, 2019 at 5:28 AM Paul St George wrote: > > On 16/08/2019 18:37, Chris Angelico wrote: > > On Sat, Aug 17, 2019 at 2:27 AM Paul St George > > wrote: > >> BUT does not work with > >> | print('test2:',os.path.realpath(n.image.filepath))| > >> > >> This returns only > >>

Re: absolute path to a file

2019-08-16 Thread Paul St George
On 16/08/2019 18:37, Chris Angelico wrote: On Sat, Aug 17, 2019 at 2:27 AM Paul St George wrote: BUT does not work with | print('test2:',os.path.realpath(n.image.filepath))| This returns only |/image01.tif| Notes: Chris, I only mention the extra leading slash on my Mac in case anyone

Re: Re: absolute path to a file

2019-08-16 Thread Chris Angelico
On Sat, Aug 17, 2019 at 2:27 AM Paul St George wrote: > BUT does not work with > | print('test2:',os.path.realpath(n.image.filepath))| > > This returns only > |/image01.tif| > > > Notes: > Chris, I only mention the extra leading slash on my Mac in case anyone > wonders why it is there. Python

Re: Re: absolute path to a file

2019-08-16 Thread Paul St George
Thank you Manfred and Cameron! I think the problem may lie within syntax rather than vocabulary. The code works in one place but not where I use it in my script*. Cameron’s suggestion works when I try | print('test1:', os.path.realpath(bpy.data.filepath))| This returns:

Re: absolute path to a file

2019-08-15 Thread Manfred Lotz
On Fri, 16 Aug 2019 09:00:38 +1000 Cameron Simpson wrote: > On 15Aug2019 22:52, Manfred Lotz wrote: > >I did this: > >from pathlib import Path > >abs_myfile = Path('./myfile').resolve() > >which worked fine for me. > > There is also os.path.realpath(filename) for this purpose. In modern >

Re: absolute path to a file

2019-08-15 Thread Cameron Simpson
On 15Aug2019 22:52, Manfred Lotz wrote: On Thu, 15 Aug 2019 22:00:17 +0200 Paul St George wrote: But I want an absolute path such as: ---Plane uses image01.tif saved at /Users/Lion/Desktop/test8/image01.tif ---Plane uses image02.tif saved at /Users/Lion/Desktop/images/image02.tif If it is

Re: absolute path to a file

2019-08-15 Thread Manfred Lotz
On Thu, 15 Aug 2019 22:00:17 +0200 Paul St George wrote: > Can someone please tell me how to get the absolute path to a file? I > have tried os.path.abspath. In the code below I have a problem in the > final line (15). > > # > |import bpy|| > ||import os|| > || > ||texture_list = []|| > || >

Re: absolute path to a file

2019-08-15 Thread Chris Angelico
On Fri, Aug 16, 2019 at 6:01 AM Paul St George wrote: > > Can someone please tell me how to get the absolute path to a file? I > have tried os.path.abspath. In the code below I have a problem in the > final line (15). > > # > |import bpy|| > ||import os|| > || > ||texture_list = []|| > || >