[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: frescobaldi clipboard file name

From: Gianmaria Lari
Subject: Re: frescobaldi clipboard file name
Date: Tue, 24 Apr 2018 08:53:01 +0200

On 23 April 2018 at 15:48, David Wright <address@hidden> wrote:
On Mon 23 Apr 2018 at 09:43:01 (+0200), Gianmaria Lari wrote:
> The following frescobaldi snippet call the "" program with the
> parameter "\\readme"
> -*- python;
> from subprocess import call
> call(["", "\\readme"])
> This other one-line snippet pastes, in the frescobaldi editor window at the
> cursor position, the lilypond file name (including path) of the current
> document
> Now I would like to merge the two worlds:) I would like a snippet that
> calls an external application passing as parameter $FILE_NAME.
> Any suggestion?

import os # likely to have been imported already
call(["", os.environ['FILE_NAME']])

I have not been able to make it working.
Let's make a step back and simplify things. 
Let's use FRESCOBALDI_VERSION that should always be defined (FILE_NAME is not defined when the file has not been explicitly saved).
And let's use a simple assignement instead of an external call.

The following code paste in the editor window the text "ciccio" at the cursor position.....

-*- python;

text = "ciccio"

Now if I try....

-*- python;
import os
text = os.environ['FRESCOBALDI_VERSION']

I expect to see pasted the frescobaldi version. But this does not work and I get the errror.... KeyError: FRESCOBALDI_VERSION.
Maybe the variables are not part of os.environ?

Thank you David,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]