I have created a pull request for my 
changes: https://github.com/henriquebastos/gnucash-to-beancount/pull/8
Let's see if Henrique bites.

On Saturday, December 9, 2017 at 7:19:29 PM UTC-6, Jason Chu wrote:
>
> I can report that this was able to convert my 2014 and 2015 files no 
> problem. Now I just have to backport all the transactions...
>
> So thanks for that. ;)
>
> On Sat, Dec 9, 2017, 5:16 PM Martin Blais <bl...@furius.ca <javascript:>> 
> wrote:
>
>> I added this to the contributions index.
>> Thanks!
>>
>>
>> On Mon, Dec 4, 2017 at 9:17 PM, Andrew Stein <andrew...@gmail.com 
>> <javascript:>> wrote:
>>
>>> enjoy!
>>>
>>> Andrew Stein
>>>
>>>
>>>
>>>
>>> On Mon, Dec 4, 2017 at 11:28 AM, <melb...@gmail.com <javascript:>> 
>>> wrote:
>>>
>>>> Thanks for this
>>>>
>>>> On Sunday, December 3, 2017 at 9:25:31 PM UTC-8, andrew...@gmail.com 
>>>> wrote:
>>>>>
>>>>> I encountered similar issues using Herique Bastos's 
>>>>> gnucash-tobeancount (
>>>>> https://github.com/henriquebastos/gnucash-to-beancount) and have seen 
>>>>> debanjum's changes (https://github.com/debanjum/gnucash-to-beancount).
>>>>>
>>>>> Personally, I am using Gnucash with 17 years of data as my "master" 
>>>>> data and doing frequent exports to beancount. I was very reluctant to 
>>>>> change the Gnucash data. For this I modified my own copy of 
>>>>> gnucash-to-beancount. Seeing this thread inspired me to clean up my work 
>>>>> and push it out to github.
>>>>> This version handles:
>>>>>
>>>>>    - Many types of special characters in account and commodity names 
>>>>>    (spaces, commas, slash, underscore, period, percent, @, &, +, ?, ', (, 
>>>>> ), 
>>>>>    ยข).
>>>>>       -  Joe's -> Joes
>>>>>       - 401(k) -> 401k
>>>>>       - CD @ 2% -> CD-at-2-pct
>>>>>    - Account names that start with '-' or a digit (401k -> X-401k)
>>>>>    - Account names that start with lower case (iBond -> IBond)
>>>>>    - Commodity names that have lower case or dashes or are longer 
>>>>>    than 24 characters.
>>>>>    - Notes with double quotes (")
>>>>>    - Accounts are open on the date of the first transaction
>>>>>    - Gnucash's hidden accounts are considered closed. I added close 
>>>>>    directives for these.
>>>>>    - Accounts are closed on the day after the last transaction
>>>>>    - Skipping of Gnucash's placeholder accounts
>>>>>    - Commodity precision is retrieved from Gnucash
>>>>>
>>>>> If anyone is interested, please give it a whirl. The code is at 
>>>>> https://github.com/AndrewStein/gnucash-to-beancount 
>>>>>
>>>>>
>>>>> On Thursday, August 31, 2017 at 2:03:11 AM UTC-5, Martin Blais wrote:
>>>>>>
>>>>>> On Wed, Aug 30, 2017 at 2:05 PM, <melb...@gmail.com> wrote:
>>>>>>
>>>>>>> Okay, I was finally able to run bean-check without any errors. I 
>>>>>>> will write down things I did in hopes that it will help someone else. I 
>>>>>>> wouldn't have been able to do with without folks on the IRC channel, 
>>>>>>> they 
>>>>>>> were really helpful. 
>>>>>>>
>>>>>>
>>>>>> That's great!
>>>>>>
>>>>>>  
>>>>>>
>>>>>>> The gnucash-to-beancount script opens all the accounts at the 
>>>>>>> beginning of the file but on some accounts the dates are later then 
>>>>>>> some of 
>>>>>>> the transactions in the file, which produces the inactive account 
>>>>>>> error. I 
>>>>>>> changed the dates for the opening statements to when the earliest 
>>>>>>> transaction was for that account. Then basically iterate this for the 
>>>>>>> rest 
>>>>>>> of the accounts with the same error.
>>>>>>>
>>>>>>
>>>>>> This would cause the second error you reported indeed. Beancount 
>>>>>> ignores the location of the directives in the file (on purpose).
>>>>>>
>>>>>>
>>>>>> Another big problem was that fact that I had a lot of account names 
>>>>>>> that are valid in gnucash which aren't valid in beancount.
>>>>>>>   * Accounts starting with lowercase
>>>>>>>   * Accounts starting with numbers
>>>>>>>   * Accounts with & in their name (e.g., Expenses:Gas-&-Electric)
>>>>>>>   * Accounts with apostrophes
>>>>>>>
>>>>>>
>>>>>> That's correct.
>>>>>> I think the converter script could be modified to make reasonable 
>>>>>> account name conversions.
>>>>>>
>>>>>>
>>>>>>  
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wednesday, August 30, 2017 at 9:31:16 AM UTC-7, melb...@gmail.com 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> For what it's worth I have also tried gnucash2ledger and then 
>>>>>>>> ledger2beancount, but I get similar errors.
>>>>>>>>
>>>>>>>> On Wednesday, August 30, 2017 at 9:26:08 AM UTC-7, 
>>>>>>>> melb...@gmail.com wrote:
>>>>>>>>>
>>>>>>>>> I'd love to try beancount but I seem to be stuck trying to convert 
>>>>>>>>> my data from gnucash. I am using 
>>>>>>>>> https://github.com/debanjum/gnucash-to-beancount to convert 4 
>>>>>>>>> years of gnucash data. When I run bean-check on the result file, I 
>>>>>>>>> get a 
>>>>>>>>> ton of errors that look like 
>>>>>>>>>
>>>>>>>>> /home/user1/beancount/foo.beancount:4505:    Invalid token: 'taxed'
>>>>>>>>> /home/user1/beancount/foo.beancount:4517:    syntax error, unexpected 
>>>>>>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>>>>>>> /home/user1/beancount/foo.beancount:4517:    Invalid token: 'k'
>>>>>>>>> /home/user1/beancount/foo.beancount:4522:    Invalid token: 'taxed'
>>>>>>>>> /home/user1/beancount/foo.beancount:4532:    syntax error, unexpected 
>>>>>>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>>>>>>> /home/user1/beancount/foo.beancount:4532:    Invalid token: 'k'
>>>>>>>>> /home/user1/beancount/foo.beancount:4537:    Invalid token: 'taxed'
>>>>>>>>> /home/user1/beancount/foo.beancount:4547:    syntax error, unexpected 
>>>>>>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>>>>>>> /home/user1/beancount/foo.beancount:4547:    Invalid token: 'k'
>>>>>>>>> /home/user1/beancount/foo.beancount:4552:    Invalid token: 'taxed'
>>>>>>>>> /home/user1/beancount/foo.beancount:4566:    syntax error, unexpected 
>>>>>>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>>>>>>> /home/user1/beancount/foo.beancount:4566:    Invalid token: 'k'
>>>>>>>>> /home/user1/beancount/foo.beancount:4571:    Invalid token: 'taxed'
>>>>>>>>> /home/user1/beancount/foo.beancount:4581:    syntax error, unexpected 
>>>>>>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>>>>>>> /home/user1/beancount/foo.beancount:4581:    Invalid token: 'k'
>>>>>>>>> /home/user1/beancount/foo.beancount:4586:    Invalid token: 'taxed'
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> followed by a ton of results like this
>>>>>>>>>
>>>>>>>>> /home/user1/beancount/foo.beancount:1168:    Invalid reference to 
>>>>>>>>> inactive account 'Expenses:House:Appliances-and-Furniture'
>>>>>>>>>
>>>>>>>>>    2014-011-06 * "AMAZON.COM          AMZN.COM/BI - Vornado fan"
>>>>>>>>>      notes: "OFX ext. info: |Trans type:Generic debit|Memo:FOOBAR 
>>>>>>>>> MERCHANDISE"
>>>>>>>>>      num: "12345023456233"
>>>>>>>>>      Liabilities:American-Express             -107.760 USD
>>>>>>>>>        memo: "FOOBAR MERCHANDISE"
>>>>>>>>>      Expenses:House:Appliances-and-Furniture   107.760 USD
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "Beancount" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>> send an email to beancount+...@googlegroups.com.
>>>>>>> To post to this group, send email to bean...@googlegroups.com.
>>>>>>> To view this discussion on the web visit 
>>>>>>> https://groups.google.com/d/msgid/beancount/fa929358-330c-4085-a3cf-9719be0e816b%40googlegroups.com
>>>>>>>  
>>>>>>> <https://groups.google.com/d/msgid/beancount/fa929358-330c-4085-a3cf-9719be0e816b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>> -- 
>>>> You received this message because you are subscribed to a topic in the 
>>>> Google Groups "Beancount" group.
>>>> To unsubscribe from this topic, visit 
>>>> https://groups.google.com/d/topic/beancount/MaaASKR1SSI/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to 
>>>> beancount+...@googlegroups.com <javascript:>.
>>>> To post to this group, send email to bean...@googlegroups.com 
>>>> <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/beancount/dd3853c5-acf2-4150-883c-4aeee5f1ffba%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/beancount/dd3853c5-acf2-4150-883c-4aeee5f1ffba%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Beancount" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to beancount+...@googlegroups.com <javascript:>.
>>> To post to this group, send email to bean...@googlegroups.com 
>>> <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/beancount/CAPdojAhQ9XT_xrhWjcpeBnDjK3T8ujRZ7sfjzO%2BcwSbTbq_RRw%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/beancount/CAPdojAhQ9XT_xrhWjcpeBnDjK3T8ujRZ7sfjzO%2BcwSbTbq_RRw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Beancount" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to beancount+...@googlegroups.com <javascript:>.
>> To post to this group, send email to bean...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/beancount/CAK21%2BhMfTARY1yLbv%2BNCEcC%3DHhjejPX9%2B3DG1W39fvGLAFyZug%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/beancount/CAK21%2BhMfTARY1yLbv%2BNCEcC%3DHhjejPX9%2B3DG1W39fvGLAFyZug%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/639e5d17-58cc-46fa-94e3-79d943ca82c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to