Heya,
  an import issue for a local beancount plugin is driving me crazy. The
plugin is (locally) installed as a python3 module that can be loaded
just fine by any python3 invocation I could imagine, but bean-check
cannot find it.

------------------------------------------------------------------------
Example/walkthrough, with commentary:

  ## bean-check fails loading the module
  zack@scaramouche:~/dati/ledger$ bean-check current.beancount 
  <load>:0:       Error importing "mybeancount.public.file_ordering": No module 
named 'mybeancount.public.file_ordering'

  ## the module is well declared in the beancount ledger, which is why
  ## bean-check tries to load it
  zack@scaramouche:~/dati/ledger$ grep -n file_ordering current.beancount 
  12:plugin "mybeancount.public.file_ordering"

  ## bean-check is executed as env python3
  zack@scaramouche:~/dati/ledger$ head -n 1 `which bean-check`
  #!/usr/bin/env python3

  ## trying by hand, the plugin loads as a module just fine
  zack@scaramouche:~/dati/ledger$ /usr/bin/env python3
  Python 3.6.4 (default, Dec 19 2017, 14:09:48) 
  [GCC 7.2.0] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import mybeancount.public.file_ordering
  >>> 

  ## trying by hand, take 2, using importlib in exact the same way that
  ## the beancount Python library does. Again, works just fine:
  zack@scaramouche:~/dati/ledger$ /usr/bin/env python3
  Python 3.6.4 (default, Dec 19 2017, 14:09:48) 
  [GCC 7.2.0] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import importlib
  >>> importlib.import_module('mybeancount.public.file_ordering')
  <module 'mybeancount.public.file_ordering' from 
'/home/zack/.local/lib/python3.6/site-packages/mybeancount/public/file_ordering.py'>
  >>> 
------------------------------------------------------------------------

What am I missing here? I've also looked for sys.path fiddling in the
beancount code, but didn't find any that seem relevant here.

I'm able to reproduce the issue on two different machines (Debian
testing and Debian Stretch), with fresh beancount installations.

Many thanks in advance for your help,
Cheers
-- 
Stefano Zacchiroli . [email protected] . upsilon.cc/zack . . o . . . o . o
Computer Science Professor . CTO Software Heritage . . . . . o . . . o o
Former Debian Project Leader & OSI Board Director  . . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20171229160941.GC16638%40upsilon.cc.
For more options, visit https://groups.google.com/d/optout.

Reply via email to