Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code in Documentation Doesn't Run #169

Open
flywire opened this issue Jun 4, 2021 · 1 comment
Open

Code in Documentation Doesn't Run #169

flywire opened this issue Jun 4, 2021 · 1 comment

Comments

@flywire
Copy link
Contributor

flywire commented Jun 4, 2021

Quickstart

book = piecash.open_book("test.gnucash", readonly=True)

  • Appears intended to be executable but no file provided.

Maybe the simplest workflow, with no stock prices, is:

from piecash import open_book

# open a GnuCash Book
gnucash_books = "../gnucash_books/"
book = open_book(gnucash_books + "test_book.gnucash", readonly=True)

Or in python [and Tutorials]

Requires:

  1. from piecash import open_book - only specific mention in Other objects
  2. setting gnucash_books variable - sample gnucash_books folder is contained in the project.

>>> session = book.session
>>>
>>> # get all account with name >= "T"
>>> session.query(Account).filter(Account.name>="T").all()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'Account' is not defined
>>> from piecash import session
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'session' from 'piecash' (C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\piecash\__init__.py)
@flywire
Copy link
Contributor Author

flywire commented Jun 12, 2021

Documentation problem needs fixing - gnucash_books not declared:

Search "(gnucash_books" (8 hits in 7 files)
piecash\docs\source\doc\doc.rst (1 hit)
Line 205: book = open_book(gnucash_books + "simple_sample.gnucash", open_if_lock=True)
\piecash\docs\source\tutorial\existing_objects\transaction.rst (1 hit)
Line 8: book = open_book(gnucash_books + "book_schtx.gnucash", open_if_lock=True)
\piecash\docs\source\tutorial\existing_objects\account.rst (1 hit)
Line 8: book = open_book(gnucash_books + "simple_sample.gnucash", open_if_lock=True)
\piecash\docs\source\tutorial\existing_objects\invoices.rst (1 hit)
Line 8: book = open_book(gnucash_books + "invoices.gnucash", open_if_lock=True)
\piecash\docs\source\tutorial\existing_objects\commodity.rst (1 hit)
Line 8: book = open_book(gnucash_books + "book_prices.gnucash", open_if_lock=True)
\piecash\docs\source\tutorial\existing_objects\open_book.rst (2 hits)
Line 44: In [1]: book = open_book(gnucash_books + "default_book.gnucash")
Line 75: book = open_book(gnucash_books + "default_book.gnucash")
\piecash\docs\source\tutorial\existing_objects\others.rst (1 hit)
Line 8: book = open_book(gnucash_books + "invoices.gnucash", open_if_lock=True)

Probably should add to top of tutorial pages:

.. note::

   Execute `gnucash_books = ""` before running tutorials from `./gnucash_books/` folder or set `gnucash_books` to path

Typical path in examples:

GNUCASH_BOOK = "../gnucash_books/simple_sample.gnucash"



Probably should add to top of examples page:

.. note::

   Examples can be run from `./examples/` folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant