Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Reusable (local) Modules

Reply
Thread Tools

Re: Reusable (local) Modules

 
 
Dave Angel
Guest
Posts: n/a
 
      09-07-2012
On 09/07/2012 01:56 PM, Travis Griggs wrote:
> I'm relatively new to Python (coming from strong C and Smalltalk backgrounds). I've written a couple of relatively small apps (one or two .py files). I'm using PyCharm (I love it).
>
> I'm curious what the pythonic approach is to creating your own reusable modules. Any tutorials or high level explanations, or detailed, much appreciated.
>
> For example, I have a small module called valvenumbers.py. It's a family of functions that we use to do a variety of things with the serial numbers we attach to some of our products. Now I'm making a little desktop app using wxpython, and I want to use (import) that module. Using PyCharm, I have two separate projects in sibling directories. And there's another separate command line tool that wants to do the same. Currently, I just place a symlink to the valvenumbers.py, local to the directory of these apps. This seems like "the quickest thing that could possibly work", but I'm assuming there's a more pythonic way to approach this general problem.
>
> TIA!
>
> Travis Griggs
> "Simplicity is the ultimate sophistication." -- Leonardo Da Vinci
>


import sys
print sys.path

This will show you your path for imports. The actual directories change
by default with different python versions, but one of them will be
suitable for putting new modules to be imported. Naturally, you don't
want to add to the place where the stdlib is placed, but some of those
are normal writable directories.

--

DaveA

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Reusable (local) Modules Dave Angel Python 0 09-07-2012 06:11 PM
Reusable (local) Modules Travis Griggs Python 0 09-07-2012 05:56 PM
Re: (updated) Choosing a collection of common modules/packages for ageneral purpose reusable PY2EXE runtime python@bdurham.com Python 2 03-20-2010 12:46 PM
How do you centrally store and include reusable javascript functions into .aspx pages? Nikki ASP .Net 3 07-02-2003 12:42 AM



Advertisments