help on how to arrange python code

Discussion in 'Python' started by Luca Fini, Oct 18, 2003.

  1. Luca Fini

    Luca Fini Guest

    I have to distribute a script (something to be run from command line)
    which is actually made up of a file containing a "main" (let's call it:
    dpu) and a few modules which are imported. Everything stays on a single
    directory for developing purposes.

    When I distribute the code to other machines, I'd like to have all those
    files on a separate directory in .../site-pakages (or any other suitable
    place), except the main script which should stay in /usr/local/bin.

    So I'm trying to use distutils to distribute the thing as a package (named
    "dpu") including a script (again named "dpu").

    Everything is distributed as expected, but when I go to run the
    application the import statements do not work. In fact I have them as,
    e.g.:

    from info import * # which works on my development directory

    but to use the modules disptributed as a package I must write:

    from dpu.info import *


    Note that I cannot put my modules on a ./dpu subdir in the development
    directory, because I'd like that the script name is "dpu" and it
    conflicts with the package directory.

    Has anybody hints on how to cope with the problem?

    Many thanks,
    l.f.

    --------------------------------------------------------------------------
    -- ) Luca Fini Tel: +39 055 2752 307
    ___ |\ INAF - Oss. Astrofisico di Arcetri Fax: +39 055 2752 292
    / | | |-_ L.go E.Fermi, 5 +-----------------------------------------
    (___|___//___) 50125 Firenze / WWW: http://www.arcetri.astro.it/~lfini
    (_) (_) Italia / e-mail:
    -----------------------------+--------------------------------------------
    Luca Fini, Oct 18, 2003
    #1
    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. Jack
    Replies:
    2
    Views:
    536
  2. PraVeeN

    Gridview columns re-arrange

    PraVeeN, Dec 8, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    382
    PraVeeN
    Dec 8, 2006
  3. Kent
    Replies:
    6
    Views:
    346
    Terry Reedy
    Mar 28, 2009
  4. shank

    arrange page heading code

    shank, Oct 12, 2003, in forum: ASP General
    Replies:
    2
    Views:
    102
    Ken Schaefer
    Oct 13, 2003
  5. James Harris

    How to arrange many files of C source code

    James Harris, Mar 2, 2013, in forum: C Programming
    Replies:
    22
    Views:
    574
    Jorgen Grahn
    Mar 14, 2013
Loading...

Share This Page