[Scons-users] SCons, Python 3, and pathlib

Russel Winder russel at winder.org.uk
Tue Jul 25 11:39:46 EDT 2017


On Tue, 2017-07-25 at 07:45 -0700, Bill Deegan wrote:
> SCons is py2 + py3, so we cannot use pathlib in the core.

Agreed, I was thinking of in my SConstruct file as I know I will not be
using the evil Python 2. ;-)

> Which file are you trying to find the path of?
> The SConstruct file?
> Some other file?

The SConstruct file.

pathlib.Path() in a SConstruct delivers '.' but this resolves to the
current directory of the execution of the PVM and not the actual
location of the file. To achieve that in a Python script one usually
uses __file__, however this special variable is not available in a
SConstruct file during a run of SCons.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170725/fbef05b3/attachment.pgp>


More information about the Scons-users mailing list