Re: Access timelog checkin datetime from python other entries

2014-12-07 Thread Alexis
Heureka,
I've been able to access a timelog's post checkin and checkout time
from python! I'm uncertain whether my way of doing it is actually
a proper solution, yet it may help in locating the cause for the
TypeError reported earlier where there is not Python class for
the boost::posix_time::ptime registered.

Feel free to have a lookน and give suggestions directed towards
a proper bugfix.


Cheers,
Alexis

น https://github.com/afh/ledger/tree/wip/py_checkin

-- 

--- 
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.


Re: Access timelog checkin datetime from python other entries

2014-12-06 Thread Alexis
Hi John,
according to % TZ=Etc/GMT+6 date it's around 5:30 AM for you now
and I shall hope you are sound asleep.

Below is a list of several python related issues in ledger (in order of
importance for me) that I would like to address sooner than later.
I've included the name of my topic branch (https://github.com/afh/ledger),
which contains some changes and testfiles in parenthesis.

Unfortunately due to my lack of familiarity with C++ and Boost::Python
the effectiveness of my debugging and programming efforts is rather limited.
So any help in fixing the issues or aiding me in addressing those is
greatly appreciated.

I will join #ledger whenever I have some time spare to see if you or
anyone else wanting to work on the issues is available.


Cheers,
Alexis

Python use post.checkin (wip/py_checkin)
  • Resolve following issue to allow access to checkin/out datetime from python:
% ./ledger python test/baseline/python-checkin.py
Traceback (most recent call last):
  File test/baseline/python-checkin.py, line 8, in module
end   = post.checkout
TypeError: No Python class registered for C++ class 
boost::optionalboost::posix_time::ptime
libc++abi.dylib: terminating with uncaught exception of type int
[1]78317 abort  ./ledger python test/baseline/python-checkin.py

Python close_journal_files() » UnitTests:  (wip/py_unit, wip/py_tests)
  • Resolve the issue when calling ledger.session.close_journal_files()
% rm test/python/*.py[co]; python -B test/python/UnitTests.py
[1]79484 segmentation fault  python -B test/python/UnitTests.py
Chaning test/python/UnitTests.py:tearDown() to just pass avoids the sigsegv

Python read multiple journal files: (wip/py_read_journals)
  • Resolve issue with multiple calls to ledger.read_journal()
% ./ledger python test/baseline/python-readjournal.py
Traceback (most recent call last):
  File test/baseline/python-readjournal.py, line 4, in module
journal_b = ledger.read_journal(test/input/drewr3.dat)
RuntimeError: Assertion failed in src/session.cc, line 192:std::size_t 
ledger::session_t::read_data(const string ): xact_count == 
journal-xacts.size()
libc++abi.dylib: terminating with uncaught exception of type int
[1]79448 abort  ./ledger python test/baseline/python-readjournal.py

Python balance reports:
  journal.collect(query) and journal.collect_accounts('query')
  is commented in python/demo.py
  if query() is the equivalent for register
  I'd like to have collect() as the equivalent for balance

Period bug: this month
  % ledger reg -p 'this month'
  may result in different xacts than
  % ledger reg -p $(date +'%b')
  Related to different ahndling of Y2014 and apply year 2014 directives?
  Need ctest case to reproduce

Python UnitTests:
  • What was the intended use of test/PyUnitTests.py
  • run test/python/UnitTests when running ctest

-- 

--- 
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.


Re: Access timelog checkin datetime from python other entries

2014-12-03 Thread Alexis
Hi John,
thanks for you reply.

 I converter needs to be registered to Boost::Python for that type.  You can
 see how this is being done from for other types in the source code.

From what I understand a converter for the datetime_t type (which is a
typedef for boost:posix_time:ptime) is being registered to Boost:Python
in export_times() found at src/py_times.cc:233.

Is my understanding wrong?

If yes, where in the source code can I find a particularly good example
for another type being registered.

I have to admit I'm rather having a hard time getting acquainted
with C++ and Boost :|


Alexis

-- 

--- 
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.


Re: Access timelog checkin datetime from python other entries

2014-12-03 Thread John Wiegley
 Alexis  surryh...@gmail.com writes:

 From what I understand a converter for the datetime_t type (which is a
 typedef for boost:posix_time:ptime) is being registered to Boost:Python in
 export_times() found at src/py_times.cc:233.

Yes, I'd thought it was being done already...

 Is my understanding wrong?

Sometimes Boost.Python can be rather finicky in what it wants.  It would take
some debugging to get down to why it's not selecting the available conversion.

 I have to admit I'm rather having a hard time getting acquainted with C++
 and Boost :|

That is only natural. :)

John

-- 

--- 
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.


Re: Access timelog checkin datetime from python other entries

2014-12-03 Thread John Wiegley
 Alexis  surryh...@gmail.com writes:

 Are you John or possibly anyone else on this list willing to work on this
 together, maybe even at the same time via IRC?

I'd be willing to take a look at it with you on IRC sometime, perhaps this
weekend.

John

-- 

--- 
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.


Re: Access timelog checkin datetime from python other entries

2014-12-03 Thread Alexis
Hello John Wiegley on Wed, Dec 03, 2014 at 10:08:14PM CET, you wrote:
 I'd be willing to take a look at it with you on IRC sometime, perhaps this
 weekend.

I would appreciate that a lot! I'm on CET, which timezone do you reside in?

Alexis

-- 

--- 
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.


Re: Access timelog checkin datetime from python other entries

2014-12-03 Thread John Wiegley
 Alexis  surryh...@gmail.com writes:

 I would appreciate that a lot! I'm on CET, which timezone do you reside in?

My available time bounces around so dramatically, but I'm in GMT-6.

John

-- 

--- 
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.