Import question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fred Lionetti

    Import question

    Hi everyone,

    Hopefully a quick question for someone out there--

    If I have a file at C:\Python23\myf older\mymodule. py

    why can't I say (from python prompt or anywhere else):
    import myfolder.mymodu le ????

    When I try to do that I get the following error message:
    ImportError: No module named myfolder.mymodu le

    Yet, myfolder really is in that location, and the sys.path includes
    "C:\Python2 3\"

    If I try appending "C:\Python23\my folder" to sys.path then I can say import
    mymodule, and it works--but that creates other problems with the file I'm
    working with.

    Any ideas????

    Thanks,
    Fred


  • Michael Peuser

    #2
    Re: Import question


    "Fred Lionetti" <lionetti@bioen g.ucsd.edu>
    [color=blue]
    > If I have a file at C:\Python23\myf older\mymodule. py
    >
    > why can't I say (from python prompt or anywhere else):
    > import myfolder.mymodu le ????[/color]

    It might help to put an empty file named __init__.py into 'myfolder'
    Kindly
    Michael P


    Comment

    Working...