cannot create python packages

Discussion in 'Python' started by Konstantinos Pachopoulos, Oct 10, 2007.

  1. Hi,
    i have the following files:
    current_dir/level1/Called.py
    current_dir/Caller.py


    Called.py:
    -----------
    class Called:
    def exec1(self):
    print "Hello"


    Caller.py:
    ----------
    from level1.Called import *

    c=Called()
    c.exec1()

    However it is impossible for Caller.py to find
    Called.py. I even tried to place the level1 structure
    inside /usr/lib/pythonX.Y/, whithout success however.
    Any ideas?

    Thnx


    ___________________________________________________________
    Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html
     
    Konstantinos Pachopoulos, Oct 10, 2007
    #1
    1. Advertising

  2. Konstantinos Pachopoulos

    mauro Guest

    On 10 Ott, 15:01, Konstantinos Pachopoulos <>
    wrote:
    > Hi,
    > i have the following files:
    > current_dir/level1/Called.py
    > current_dir/Caller.py
    >
    > Called.py:
    > -----------
    > class Called:
    > def exec1(self):
    > print "Hello"
    >
    > Caller.py:
    > ----------
    > from level1.Called import *
    >
    > c=Called()
    > c.exec1()
    >
    > However it is impossible for Caller.py to find
    > Called.py. I even tried to place the level1 structure
    > inside /usr/lib/pythonX.Y/, whithout success however.
    > Any ideas?
    >
    > Thnx
    >
    > ___________________________________________________________
    > Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html


    I think you need a __init__.py file in level1 directory
     
    mauro, Oct 10, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul  Smith
    Replies:
    0
    Views:
    755
    Paul Smith
    Nov 18, 2003
  2. Alan Isaac

    cannot have test scripts in packages?

    Alan Isaac, Jun 22, 2007, in forum: Python
    Replies:
    0
    Views:
    260
    Alan Isaac
    Jun 22, 2007
  3. Waldy
    Replies:
    4
    Views:
    516
    Waldy
    Aug 3, 2007
  4. David Lyon
    Replies:
    19
    Views:
    609
    David Lyon
    Apr 24, 2009
  5. Ian
    Replies:
    3
    Views:
    190
Loading...

Share This Page