Dear Rushad,
Rushad Faridi writes:
> Firs I tried ledger 2.x approach since 3.x can not do the conversion. I
> had not much of a problem installing 2.x but after I issued the command "
> ledger -f myfile.gnucash print > myfile.txt" it spitted out 27 lines of
> error with something " invalid date string". I had a cursory look at my
> account entries but did not find anything wrong. Any suggestions on how to
> fix that?
What were the errors that you saw? Probably someone here can help you with
this, but we'd need more information about what went wrong.
> Anyway, I went ahead
> and ran the python script "gnucash2ledger.py" downloaded from
> "https://github.com/MatzeB/pygnucash; in the following manner:
>
> python2.7 gnucash2ledger.py myfile.gnucash print > test.txt
(It does not look like you should have "print" in this command line invocation,
though probably the Python program is just ignoring it.)
> The error came through is as follows:
>
> Traceback (most recent call last):
> File "gnucash2ledger.py", line 35, in
> data = gnucash.read_file(sys.argv[1])
> AttributeError: 'module' object has no attribute 'read_file'
This is a strange error to see, if you are indeed using the code from that
repository. Python is complaining that it can't find the read_file function in
the gnucash module. But the gnucash module from that repository does contain
such a function. So either you're importing a *different* module named
"gnucash", or something very weird is happening in the gnucash2ledger module
that messes up the attributes of its own gnucash module. I suspect the former.
Try this:
1) Run a Python interpreter from a directory *outside* the repository you
referenced (so that the pygnucash code is not on Python's search path).
2) Type 'import gnucash' at the prompt. You should see an ImportError.
3) If you do *not* see an ImportError, your Python is importing some other
module named 'gnucash' (perhaps this comes with GnuCash itself?). Try typing:
gnucash.__file__
gnucash.__path__
at the Python prompt. This will tell you where the conflicting gnucash module
is located.
4) If you *do* see an ImportError, quit Python, and try these steps again, but
this time run Python from *inside* the pygnucash repository. This time, you
should *not* see an ImportError. In that case, make sure that gnucash.__file__
and gnucash.__path__ are what you'd expect, and then try
hasattr(gnucash, 'read_file')
This should return True.
Let us know what you see!
Best,
Richard
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.