Re: glib-mkenums in glib 2



On 13-01-04 02:13 AM, John Emmas wrote:
On 30 Dec 2012, at 16:36, John Ralls wrote:


Hmm. Your python doesn't seem to agree that codegen is a package, in spite of being imported into gdbus-codegen.



On 30 Dec 2012, at 16:40, jose aliste gmail com wrote:

I don't know if this is related, but It seems you are missing the empty  __init__.py in the codegen/ directory. This is a requirement for a directory so python may consider it as a package.


Hi guys,

Maybe you'll remember that I eventually bought a Python programming book and ran some examples which also used the 'from / import' construct.  The textbook examples worked but building this gdbus stuff still wouldn't work.  Well, eventually I spotted a difference which I think might be important....

Each sample package from my textbook does have that file __init__.py.  But when I run the actual sample, a second file gets generated, called '__init__.pyc'.  If I delete that file and then run the sample again, it gets regenerated each time.  This isn't happening with the gdbus code.  Although the codegen package does have a file called __init__.py, I never see a file called __init__.pyc getting generated.

Could that be significant?  I think perhaps that explains why codegen isn't getting recognised as a package.


That file is cached bytecode that Python compiles to avoid re-compiling it at runtime each time the script is imported (unless the file changed). If Python can't import your module/package, those .pyc files won't be compiled.

From the last few messages on this thread, it kind of sounds like your module search path is not set up correctly, that is, Python doesn't know where to look to import your modules/packages (try "print(sys.path)" to see which paths I mean). There's good docs about this on python.org (as well as all kinds of other excellent docs/tuts).

Good luck,
Matthew Brush



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]