Re: gnucash 2.7.1: ERROR: Unbound variable: gnc-build-dotgnucash-path

2017-11-20 Thread Geert Janssens
Op maandag 20 november 2017 19:48:41 CET schreef Geert Janssens:
> Op maandag 20 november 2017 06:02:20 CET schreef John Ralls:
> > > On Nov 19, 2017, at 8:28 PM, Sébastien de Menten 
> > > wrote:
> > > 
> > > btw, how can I keep backward compatibility in this case so that my
> > > reports
> > > work for both gnucash 2.7/2.8 and gnucash 2.6 ?
> > > 
> > > 
> > > On Sun, Nov 19, 2017 at 5:51 PM, Sébastien de Menten
> > >  > > > wrote: Ok, thanks for the clarification.
> > > 
> > > On Nov 19, 2017 16:05, "John Ralls"  > > >
> wrote:
> > > > On Nov 19, 2017, at 6:20 AM, Sébastien de Menten  > > > > wrote:
> > > > 
> > > > Not sure if it is a bug with gnucash 2.7.1, but I can't use
> > > > the gnc-build-dotgnucash-path in the config.user as I get an unbound
> > > > variable.
> > > > any clue?
> > > > is this the right list for questions re gnucash 2.7.1 or should I use
> > > > the
> > > > gnucash-user ML ?
> > > 
> > > It’s renamed to gnc-build-userdata-path. See
> > > libgnucash/core-utils/core-utils.scm.
> > > 
> > > Depends on the question. API questions usually belong here.
> > 
> > Please remember to copy the list on all replies.
> > 
> > The pythonic way would be to catch the unbound variable exception and try
> > the other one in the handler.
> > 
> > Regards,
> > John Ralls
> > 
> > ___
> > gnucash-devel mailing list
> > gnucash-devel@gnucash.org
> > https://lists.gnucash.org/mailman/listinfo/gnucash-devel
> 
> There was an api change in the way saved reports were stored between 2.4 and
> 2.6. To make the script work on both 2.4 and 2.6 the following construct
> was used:
> 
> (if (defined? 'gnc:restore-report-by-guid-with-custom-template)
> 
> 
> You can use a similar test for this particular case:
> 
> (if (defined? 'gnc-build-userdata-path)
> 
> 
> Regards,
> 
> Geert
> ___
> gnucash-devel mailing list
> gnucash-devel@gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Interestingly half of the example code got stripped somewhere.

I'll try again, adding some quotation characters:

> (let ((path (if (defined? 'gnc-build-userdata-path)
> (gnucash-build-userdata-path)
> (gnc-dotgnucash-path))))
>  (do-something-with path))


Geert
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: gnucash 2.7.1: ERROR: Unbound variable: gnc-build-dotgnucash-path

2017-11-20 Thread Geert Janssens
Op maandag 20 november 2017 06:02:20 CET schreef John Ralls:
> > On Nov 19, 2017, at 8:28 PM, Sébastien de Menten 
> > wrote:
> > 
> > btw, how can I keep backward compatibility in this case so that my reports
> > work for both gnucash 2.7/2.8 and gnucash 2.6 ?
> > 
> > 
> > On Sun, Nov 19, 2017 at 5:51 PM, Sébastien de Menten  > > wrote: Ok, thanks for the clarification.
> > 
> > On Nov 19, 2017 16:05, "John Ralls"  > > 
wrote:
> > > On Nov 19, 2017, at 6:20 AM, Sébastien de Menten  > > > wrote:
> > > 
> > > Not sure if it is a bug with gnucash 2.7.1, but I can't use
> > > the gnc-build-dotgnucash-path in the config.user as I get an unbound
> > > variable.
> > > any clue?
> > > is this the right list for questions re gnucash 2.7.1 or should I use
> > > the
> > > gnucash-user ML ?
> > 
> > It’s renamed to gnc-build-userdata-path. See
> > libgnucash/core-utils/core-utils.scm.
> > 
> > Depends on the question. API questions usually belong here.
> 
> Please remember to copy the list on all replies.
> 
> The pythonic way would be to catch the unbound variable exception and try
> the other one in the handler.
> 
> Regards,
> John Ralls
> 
> ___
> gnucash-devel mailing list
> gnucash-devel@gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel

There was an api change in the way saved reports were stored between 2.4 and 
2.6. To make 
the script work on both 2.4 and 2.6 the following construct was used:

(if (defined? 'gnc:restore-report-by-guid-with-custom-template) 


You can use a similar test for this particular case:

(if (defined? 'gnc-build-userdata-path) 


Regards,

Geert
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: gnucash 2.7.1: ERROR: Unbound variable: gnc-build-dotgnucash-path

2017-11-20 Thread John Ralls


> On Nov 20, 2017, at 9:02 AM, Sébastien de Menten  wrote:
> 
> yes, the same can be done in scheme but the question is "will scheme 
> reports/scripts need to be rewritten for Gnucash 2.7/2.8?" (i.e. no back 
> compatibility guaranteed)
> 
> On Mon, Nov 20, 2017 at 5:50 PM, John Ralls  > wrote:
> 
> 
>> On Nov 20, 2017, at 1:37 AM, Sébastien de Menten > > wrote:
>> 
>> Indeed. But in gnucash guile world, how will scm scripts using the old API 
>> still work tomorrow ? Or do they need a migration/versioning per gnucash 
>> version ?
>> 
>> On Nov 20, 2017 06:04, "John Ralls" > > wrote:
>> 
>> 
>>> On Nov 19, 2017, at 8:28 PM, Sébastien de Menten >> > wrote:
>>> 
>>> btw, how can I keep backward compatibility in this case so that my reports 
>>> work for both gnucash 2.7/2.8 and gnucash 2.6 ?
>>> 
>>> 
>>> On Sun, Nov 19, 2017 at 5:51 PM, Sébastien de Menten >> > wrote:
>>> Ok, thanks for the clarification. 
>>> 
>>> On Nov 19, 2017 16:05, "John Ralls" >> > wrote:
>>> 
>>> 
>>> > On Nov 19, 2017, at 6:20 AM, Sébastien de Menten >> > > wrote:
>>> >
>>> > Not sure if it is a bug with gnucash 2.7.1, but I can't use
>>> > the gnc-build-dotgnucash-path in the config.user as I get an unbound
>>> > variable.
>>> > any clue?
>>> > is this the right list for questions re gnucash 2.7.1 or should I use the
>>> > gnucash-user ML ?
>>> 
>>> It’s renamed to gnc-build-userdata-path. See 
>>> libgnucash/core-utils/core-utils.scm.
>>> 
>>> Depends on the question. API questions usually belong here.
>> 
>> Please remember to copy the list on all replies.
>> 
>> The pythonic way would be to catch the unbound variable exception and try 
>> the other one in the handler.
> 
> I’m not much of a schemer so someone more fluent should chime in… but Scheme 
> also has exceptions so I imagine that the same pattern would work.

Yes. We make no guarantees about API stability. The only backwards 
compatibility guarantee is that the last release of a stable series will be 
able to load (but not necessarily write) the data of the new stable series and 
that data files will be stable during a stable series.

That said, we do need to look for and document API changes for 2.8. We also 
need a nice user-friendly “what’s new” document.

Regards,
John Ralls


___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: gnucash 2.7.1: ERROR: Unbound variable: gnc-build-dotgnucash-path

2017-11-20 Thread Sébastien de Menten
yes, the same can be done in scheme but the question is "will scheme
reports/scripts need to be rewritten for Gnucash 2.7/2.8?" (i.e. no back
compatibility guaranteed)

On Mon, Nov 20, 2017 at 5:50 PM, John Ralls  wrote:

>
>
> On Nov 20, 2017, at 1:37 AM, Sébastien de Menten 
> wrote:
>
> Indeed. But in gnucash guile world, how will scm scripts using the old API
> still work tomorrow ? Or do they need a migration/versioning per gnucash
> version ?
>
> On Nov 20, 2017 06:04, "John Ralls"  wrote:
>
>>
>>
>> On Nov 19, 2017, at 8:28 PM, Sébastien de Menten 
>> wrote:
>>
>> btw, how can I keep backward compatibility in this case so that my
>> reports work for both gnucash 2.7/2.8 and gnucash 2.6 ?
>>
>>
>> On Sun, Nov 19, 2017 at 5:51 PM, Sébastien de Menten > > wrote:
>>
>>> Ok, thanks for the clarification.
>>>
>>> On Nov 19, 2017 16:05, "John Ralls"  wrote:
>>>


 > On Nov 19, 2017, at 6:20 AM, Sébastien de Menten 
 wrote:
 >
 > Not sure if it is a bug with gnucash 2.7.1, but I can't use
 > the gnc-build-dotgnucash-path in the config.user as I get an unbound
 > variable.
 > any clue?
 > is this the right list for questions re gnucash 2.7.1 or should I use
 the
 > gnucash-user ML ?

 It’s renamed to gnc-build-userdata-path. See
 libgnucash/core-utils/core-utils.scm.

 Depends on the question. API questions usually belong here.

>>>
>> Please remember to copy the list on all replies.
>>
>> The pythonic way would be to catch the unbound variable exception and try
>> the other one in the handler.
>>
>
> I’m not much of a schemer so someone more fluent should chime in… but
> Scheme also has exceptions so I imagine that the same pattern would work.
>
> Regards,
> John Ralls
>
>
>
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: gnucash 2.7.1: ERROR: Unbound variable: gnc-build-dotgnucash-path

2017-11-20 Thread John Ralls


> On Nov 20, 2017, at 1:37 AM, Sébastien de Menten  wrote:
> 
> Indeed. But in gnucash guile world, how will scm scripts using the old API 
> still work tomorrow ? Or do they need a migration/versioning per gnucash 
> version ?
> 
> On Nov 20, 2017 06:04, "John Ralls"  > wrote:
> 
> 
>> On Nov 19, 2017, at 8:28 PM, Sébastien de Menten > > wrote:
>> 
>> btw, how can I keep backward compatibility in this case so that my reports 
>> work for both gnucash 2.7/2.8 and gnucash 2.6 ?
>> 
>> 
>> On Sun, Nov 19, 2017 at 5:51 PM, Sébastien de Menten > > wrote:
>> Ok, thanks for the clarification. 
>> 
>> On Nov 19, 2017 16:05, "John Ralls" > > wrote:
>> 
>> 
>> > On Nov 19, 2017, at 6:20 AM, Sébastien de Menten > > > wrote:
>> >
>> > Not sure if it is a bug with gnucash 2.7.1, but I can't use
>> > the gnc-build-dotgnucash-path in the config.user as I get an unbound
>> > variable.
>> > any clue?
>> > is this the right list for questions re gnucash 2.7.1 or should I use the
>> > gnucash-user ML ?
>> 
>> It’s renamed to gnc-build-userdata-path. See 
>> libgnucash/core-utils/core-utils.scm.
>> 
>> Depends on the question. API questions usually belong here.
> 
> Please remember to copy the list on all replies.
> 
> The pythonic way would be to catch the unbound variable exception and try the 
> other one in the handler.

I’m not much of a schemer so someone more fluent should chime in… but Scheme 
also has exceptions so I imagine that the same pattern would work.

Regards,
John Ralls


___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: gnucash 2.7.1: ERROR: Unbound variable: gnc-build-dotgnucash-path

2017-11-20 Thread Sébastien de Menten
Indeed. But in gnucash guile world, how will scm scripts using the old API
still work tomorrow ? Or do they need a migration/versioning per gnucash
version ?

On Nov 20, 2017 06:04, "John Ralls"  wrote:

>
>
> On Nov 19, 2017, at 8:28 PM, Sébastien de Menten 
> wrote:
>
> btw, how can I keep backward compatibility in this case so that my reports
> work for both gnucash 2.7/2.8 and gnucash 2.6 ?
>
>
> On Sun, Nov 19, 2017 at 5:51 PM, Sébastien de Menten 
> wrote:
>
>> Ok, thanks for the clarification.
>>
>> On Nov 19, 2017 16:05, "John Ralls"  wrote:
>>
>>>
>>>
>>> > On Nov 19, 2017, at 6:20 AM, Sébastien de Menten 
>>> wrote:
>>> >
>>> > Not sure if it is a bug with gnucash 2.7.1, but I can't use
>>> > the gnc-build-dotgnucash-path in the config.user as I get an unbound
>>> > variable.
>>> > any clue?
>>> > is this the right list for questions re gnucash 2.7.1 or should I use
>>> the
>>> > gnucash-user ML ?
>>>
>>> It’s renamed to gnc-build-userdata-path. See
>>> libgnucash/core-utils/core-utils.scm.
>>>
>>> Depends on the question. API questions usually belong here.
>>>
>>
> Please remember to copy the list on all replies.
>
> The pythonic way would be to catch the unbound variable exception and try
> the other one in the handler.
>
> Regards,
> John Ralls
>
>
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel