Python application launcher (for Python code)

Deborah Swanson python at deborahswanson.net
Mon Feb 20 23:42:49 EST 2017


Steve D'Aprano wrote, on February 20, 2017 5:25 PM
> 
> On Tue, 21 Feb 2017 02:44 am, Deborah Swanson wrote:
> 
> [...]
> > Basically, I now have quite a few Python programs I use frequently, 
> > and as time goes on my collection and uses of it will grow. 
> Right now 
> > I just want a way to select which one I'd like to run and 
> run it. I'd 
> > like it to be a standalone application and some sort of system of 
> > categories would be nice.
> 
> Here's a possible work-flow that might be suitable for you. 
> I'm going to write it in Linux-speak, you can hopefully 
> translate it to Windows yourself.
> 
> (1) Organise your scripts into separate directories according 
> to your preferred way of categorising them:
> 
> /home/steve/python/fun/
> /home/steve/python/serious/
> /home/steve/python/work/
> 
> Move each script into the appropriate directory.
> 
> (2) Add each category to the PYTHONPATH. One easy way to do 
> so is by adding the directories to a .pth file. Create the file:
> 
> /home/steve/.local/lib/python3.5/site-packages/default.pth
> 
> (the name is not important so long as it ends with .pth; the 
> location is)
> 
> containing the three lines:
> 
> /home/steve/python/fun/
> /home/steve/python/serious/
> /home/steve/python/work/
> See the documentation for the site module for more detail:
> 
>https://docs.python.org/3/library/site.html

>(3) Now you can run any of your scripts by name, without caring
precisely where it is:

python3 -m myscript


or you can explicitly choose one:

cd ~  # change to my home directory
python3 python/fun/myscript.py

Thanks, Steve. This is similar to what I thought I could do on Windows,
but with no nicety like the .pth file and its associated usefulness.

> I'm migrating tasks I've always done in Excel to Python, and I have a 
> sketchy idea of features I'd like to open Excel with, but I hate Excel

> VBA so much that I haven't written an on_Open macro for Excel yet.

You might consider using LibreOffice. It is intended to be backwards
compatible with Excel, but is scriptable using four different languages:

Basic
Python
Javascript
BeanShell


Start here:

https://duckduckgo.com/html/?q=scripting+libreoffice

-- 
Steve
"Cheer up," they said, "things could be worse." So I cheered up, and
sure enough, things got worse.

I have LibreOffice 5 (no Python scripting), and the scripting with
Python in some later version may be nice, but the interface itself is
clunkier than Excel, and maybe as flakey and unreliable as Excel. I
don't know that, but I've  only sporadically used LibreOffice for less
than 5 years, where I've been using other spreadsheets since 1988,
mostly Excel and in the beginning Lotus 123 (that was on a real DOS box,
the kind you only had floppy drives on). They're all clunky in one
aspect or another, and I just want the spreadsheet functionality in
straight Python, even if it has to be DIY, but to get all of Excel's (or
LibreOffice's) functionality, I'll need the tool I've been asking about
in this thread, and several others if this group knows anything about
them. I'll maybe write more about that in another topic, but probably
not right away. Not sure if there's all that much interest in the topic
here.

Thanks for your comments,

Deborah




More information about the Python-list mailing list