Re: glib-mkenums in glib 2



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

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

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.
> Try changing the line to just "import config".
> 

Thanks for the suggestions.  I checked for  '__init__.py' and discovered that it is actually present in the codegen subdirectory.  I also tried using John's abbreviated instruction but that didn't help much.

So I bought myself a book on Python programming and immediately turned to the section that deals with from / import.  It's quite a long way into the book (Chapter 11) in a section that deals with complex subjects such as graphics and sound (for game programming).  The first thing I did was to try and run one of the samples but I immediately hit the same problem that I found with gdbus-codegen, namely:-

      from  livewires  import  games
      ValueError: Attempted relative import in non-package

I read through Chapter 11 and realised that I needed to download two packages (called 'games' and 'livewires') from the author's web site.  The installer seemed to install them into a subfolder of my main Python installation.  However, once they were installed I could then run the scripts from that chapter without seeing any 'from / import' errors.

I'm not really sure what the installation did - so for the hell of it, I decided to copy everything from 'gio/gdbus-2.0/codegen' into that same subfolder.  What's interesting is that having done that I can now open my Python shell and type in:-

      from  codegen  import  codegen_main

and I don't see any errors.  But it hasn't made any difference if I try to run 'gdbus-codegen.py'

So some progress has been made...  at least I've encountered a 'from / import' error which I was able to fix but I don't have any real idea about why it's going wrong.

If anyone has a flash of inspiration, please let me know.

Happy New Year!

John.


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