[FRPythoneers] import question

Sean Reifschneider jafo at tummy.com
Wed Dec 5 14:05:30 MST 2001


I usually use os.path.join, so in this case it would be:

   os.path.join(os.sep, 'python', 'piece1')

Sean

On Wed, Dec 05, 2001 at 01:25:37PM -0700, Jim Vickroy wrote:
>Even when running on MS Windows, the forward slash '/' may be used to separate
>subdirectories.  For example:
>
>   sys.path.append('/python/piece1')
>
>also works and may be preferable.
>
>Alternately, use os.sep (from the os module) which is mapped to backward slash on
>MS Windows.
>
>Sean Reifschneider wrote:
>
>> On Wed, Dec 05, 2001 at 01:12:50PM -0700, Sherman Lambert wrote:
>> >to segregate scripts into different directories.  However I have yet to
>> >figure out how to import scripts not in the current path, or the python
>> >path.  I am using python on Win 9x.  I thought that I could just give the
>>
>> Python searches the PYTHONPATH to locate modules.  I have a common
>> directory where I put my python modules.
>>
>> >path to the import statement. however that does not seem to work.  I detail
>> >I have a project in \project, I am trying to reference a script in
>> >\python\piece1.  Any clues (this should be simple, shouldn't it?).
>>
>> You can change the PYTHONPATH in your code:
>>
>>    import sys
>>    sys.path.append('\\python\\\piece1')
>>    import piecemodule
>>
>> Sean
>> --
>>  Blaming the software quality on the tool is like saying "I can't pick up
>>  chicks because my car isn't cool enough."  -- Sean Reifschneider, 1998
>> Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
>> tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python
>> _______________________________________________
>> This message sent by the FRPythoneers mailing list.
>> Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
>> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
>
>_______________________________________________
>This message sent by the FRPythoneers mailing list.
>Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
>URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers

-- 
 It's not a recursive function except in the sense that it calls itself.
                 -- demoncrat on #python, 1999
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python



More information about the FRPythoneers mailing list