[Baypiggies] __init__.py.in

Glen Jarvis glen at glenjarvis.com
Thu Nov 12 20:35:47 CET 2009


Alison,
   I'm not familiar with your package, so I'm sure others will be able to
help give more details on why this is set up this way. But, let me tell you
what an __init__.py file is. Also, I can show you how to get started in the
short term.

    A module in python is almost like a directory (on your python path). For
example, lets say we have a directory like this:

my_cool_module
    my_cool_file1.py
    my_cool_file2.py

Now, it'd be very "cool" if I could do this:

from my_cool_module.my_cool_file1.py import my_cool_function

(okay forgive my bad naming and overuse of the word 'cool' :)

This won't work without a __init__.py file inside:

my_cool_module
    __init__.py
    my_cool_file1.py
    my_cool_file2.py

You can almost think of it as a "directory" of your module files. Now, the
file doesn't have to have any python code it it (but it can if you really
want to do some special things). It only has to exist.

With all that said, I'm not sure what your __init__.py.in file contains. It
may be an empty file. However, to use any module, you need to have an
__init__.py file.

So, it may be as simple as:

cp __init__.py.in __init__.py

Or, if there's nothing in the file, simply creating a blank one will let you
move on:

touch __init__.py


This doesn't get you totally out of the weeds. But, hopefully it helps a
little.


Warmest Regards,


Glen Jarvis



On Thu, Nov 12, 2009 at 11:22 AM, Alison Chaiken <alchaiken at gmail.com>wrote:

> Sorry for this newbie question, but I'm stumped.     I'd like to use
> package pyatspi, which comes with (among other things) a file called
> __init__.py.in.    The instructions for installation say to run
> "python setup.py install" as expected.     However "python setup.py
> install" and "python setup.py build" give me the error
>
> running build
> running build_py
> package init file '__init__.py' not found (or not a regular file)
> package init file '__init__.py' not found (or not a regular file)
>
> Well yeah, the svn download doesn't provide an __init__.py file, so I
> don't have one!
>
> What step am I missing here?     How do I turn __init__.py.in into
> __init__.py?    I can't find the answer in G****e.
>
> Alternatively, what I wish to do is to use pyatspi to switch linux
> desktop screens under programmatic control.    Is there a more
> recommended package that provides this capability.
>
> Thanks,
> Alison
>
>
> --
> Alison Chaiken
> (650) 279-5600  (cell)
>    http://www.exerciseforthereader.org/
> The revolution will be automated.   -- David E. Calkins, riffing on
> Gil Scott-Heron's "The revolution will not be televised."
> Sent from Stanford, CA, United States
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20091112/2b8ddb9e/attachment.htm>


More information about the Baypiggies mailing list