I want to show off for my Mom (and Python won't let me!)

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

elirarey
Posts: 3
Joined: Wed Aug 06, 2008 7:14 pm UTC

I want to show off for my Mom (and Python won't let me!)

Postby elirarey » Wed Aug 06, 2008 7:31 pm UTC

This is a thread related to the common question of "Which programming language is for me?" but with a more specific take on the situation.

I used to program in BASIC and C/C++ about 15 years ago, but then became distracted by making plays and movies. Now I'm trying to get back into it again, but (as many have found before me) if I'm not able to keep it fun, I will quickly forget about it and move on to gardening or jiu-jitsu as my new hobby of choice. This may be for the best, but in any case ...

I started using Python and find it easy to understand and use -- but there seems to be a major limitation in terms of turning a Python script into an executable. This might seem like a minor problem, but (as my post heading indicates) I want to show the little programs I make to other people, usually people who don't have python installed on their computers.

So, to the question: if I invest further time in learning Python (and getting used to Linux, to which I have recently switched) will the solution to the problem above become self-evident, or should I learn another language instead/in addition in order to be able to create simple executables that I can email to my Mom and which she will be able to run on her Windows system. (For example, would I be better off learning a website-oriented language, so my masterpieces can go up on my website for my Mom and all to see?)

Also, just for the record, I would settle for being able to show off to my husband. This problem requires slightly less rigor, because I can sneak onto his laptop and install programs. However, I would still need him to be able to double-click on the file and have it execute, as opposed to going into his terminal and running the program from there. You may notice that my dabbling in theater has left my sense of drama intact.

User avatar
misskwiz
Posts: 96
Joined: Wed Mar 21, 2007 6:19 am UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby misskwiz » Wed Aug 06, 2008 8:09 pm UTC

Behold, py2exe! :D

From the website wrote:py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.

py2exe is used by BitTorrent, SpamBayes, and thousands more.
I am currently enjoying the pathetic anger bread of a dissatisfied life.

pnyxtr
Posts: 104
Joined: Thu Jun 12, 2008 8:03 pm UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby pnyxtr » Wed Aug 06, 2008 9:00 pm UTC

I had some problems with py2exe (which, I have long since forgotten), and moved to PyInstaller instead. You may want to try that as well.

btilly
Posts: 1877
Joined: Tue Nov 06, 2007 7:08 pm UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby btilly » Wed Aug 06, 2008 9:45 pm UTC

Another option to consider is learning some JavaScript. Then you can put them on your website, or you can send emails with web pages attached demonstrating your cool stuff.
Some of us exist to find out what can and can't be done.

Others exist to hold the beer.

User avatar
spdqbr
Posts: 171
Joined: Sat Mar 08, 2008 1:41 am UTC
Location: A shaker of salt

Re: I want to show off for my Mom (and Python won't let me!)

Postby spdqbr » Thu Aug 07, 2008 3:34 am UTC

If you're up to learning a new language, Java + JSmooth has worked pretty well for me. I came across it when my father asked if a certain little application existed, and I found the existing solutions to be lacking so I bodged one together in Java. My favorite thing is that if it doesn't find the appropriate jre for the program, it will ask the user and then download and install it for them.

It's good to know about these utils for python though! I will certainly have to use them.
In questions of science, the authority of a thousand is not worth the humble reasoning of a single individual.

Galileo

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: I want to show off for my Mom (and Python won't let me!)

Postby Berengal » Thu Aug 07, 2008 4:19 am UTC

You could also write it in jython (the differences between it and python are minor) and compile it to java bytecode. You still need java installed, but the chances of that are much higher than python being installed.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
thoughtfully
Posts: 2253
Joined: Thu Nov 01, 2007 12:25 am UTC
Location: Minneapolis, MN
Contact:

Re: I want to show off for my Mom (and Python won't let me!)

Postby thoughtfully » Thu Aug 07, 2008 5:27 pm UTC

There's also IronPython (this too), which is based on .NET, and is a little more current than Jython. PyInstaller and the rest work fairly well most of the time, but if you have a lot of packages which can generate their dependencies dynamically at runtime, it can be hell getting them to work right. I had to roll my own solution once, but I was getting paid to do it, and it involved a lot of arcane black magic and what not.

You ought to be able to install Python and friends on a flash drive and run it that way, too.

EDIT: A drawback to Jython and IronPython is that you can't use compiled modules, like numpy and all the stuff that depends on it.
Image
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery

elirarey
Posts: 3
Joined: Wed Aug 06, 2008 7:14 pm UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby elirarey » Thu Aug 07, 2008 10:10 pm UTC

Thanks for all the good info. I think I will stick with python a little longer and use these installers. But I predict Java and Javascript in my future.

I know that it is possible to use these languages together on the same webpage, but right now I don't even understand how to use a script on a webpage. Maybe that will come later in my learning? :roll:

Anyone know of a good online tutorial for using scripting (python or otherwise) in web development?

btilly
Posts: 1877
Joined: Tue Nov 06, 2007 7:08 pm UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby btilly » Thu Aug 07, 2008 10:47 pm UTC

elirarey wrote:Thanks for all the good info. I think I will stick with python a little longer and use these installers. But I predict Java and Javascript in my future.

I know that it is possible to use these languages together on the same webpage, but right now I don't even understand how to use a script on a webpage. Maybe that will come later in my learning? :roll:

Anyone know of a good online tutorial for using scripting (python or otherwise) in web development?

How do use a script on a webpage is different for JavaScript and most other things.

With JavaScript you put the JavaScript directly in the HTML. There are three ways of doing it. One is to put it between <script>...</script> tags. The second is that a number of HTML attributes can contain snippets of JavaScript. And the third is that you can load a JavaScript file from an HTML page. In all three cases the JavaScript runs in the browser. We therefore say that JavaScript is a client side language. Java applets, and Flash scripts can also run on the client side.

Python is a server-side language. The idea is simple - a request for a web page from a web browser results in running code on the server that produces your page on the fly. There are several ways to implement this idea. The simplest is CGI. In this every page request causes a program to be launched, information is passed in through environment variables and standard in, the program produces output, then it exits. The output has to be a small header followed by the HTML page. Most of the heavy lifting is done for you by various libraries. In Python http://docs.python.org/lib/module-cgi.html has most of the utility functions that you need.

I won't get into best practices, various frameworks, improvements like mod_python that give you much better speed, and the like. There is a lot to learn, but none of it is needed to get started. However if you search for information on CGI, you should be able to figure out how to install some webserver that supports CGI, and use it to make Python scripts to create dynamic web pages on the fly. Then you can point people at your webserver, and they can see the result of your hard work without installing things on their end. :-)
Some of us exist to find out what can and can't be done.

Others exist to hold the beer.

pnyxtr
Posts: 104
Joined: Thu Jun 12, 2008 8:03 pm UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby pnyxtr » Fri Aug 08, 2008 12:21 am UTC

elirarey wrote:Thanks for all the good info. I think I will stick with python a little longer and use these installers. But I predict Java and Javascript in my future.

I know that it is possible to use these languages together on the same webpage, but right now I don't even understand how to use a script on a webpage. Maybe that will come later in my learning? :roll:

Anyone know of a good online tutorial for using scripting (python or otherwise) in web development?

Do stick to Python. Those Java and M$ drones have a tendency to pop up everywhere, for some reason. Pay them no mind.

User avatar
r1chard
Posts: 281
Joined: Thu Dec 06, 2007 2:17 am UTC
Location: Melbourne, AU
Contact:

Re: I want to show off for my Mom (and Python won't let me!)

Postby r1chard » Fri Aug 08, 2008 1:40 am UTC

elirarey wrote:Anyone know of a good online tutorial for using scripting (python or otherwise) in web development


http://www.djangoproject.com/documentation/tutorial01/

There's also videos you can watch - just search google for "django video" to find a bunch.

elirarey
Posts: 3
Joined: Wed Aug 06, 2008 7:14 pm UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby elirarey » Mon Aug 11, 2008 3:32 am UTC

Thanks again -- esepcially btilly for that great explanation of client-side and server-side scripts. Now I understand!

The light has dawned.

User avatar
Xanthir
My HERO!!!
Posts: 5426
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: I want to show off for my Mom (and Python won't let me!)

Postby Xanthir » Wed Aug 27, 2008 2:06 pm UTC

pnyxtr wrote:
elirarey wrote:Thanks for all the good info. I think I will stick with python a little longer and use these installers. But I predict Java and Javascript in my future.

I know that it is possible to use these languages together on the same webpage, but right now I don't even understand how to use a script on a webpage. Maybe that will come later in my learning? :roll:

Anyone know of a good online tutorial for using scripting (python or otherwise) in web development?

Do stick to Python. Those Java and M$ drones have a tendency to pop up everywhere, for some reason. Pay them no mind.

It may be instructive to realize that Javascript has absolutely nothing to do with Java. Nothing at all.

I'm trying to get used to calling it ECMAscript for precisely this reason.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
e946
Posts: 621
Joined: Wed Jul 11, 2007 6:32 am UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby e946 » Fri Aug 29, 2008 6:42 am UTC

Django is a great way to do what you're trying to do. It's basically a python web framework, so instead if showing people neat little programs you'll show them neat little web pages.

Shaitan Apistos
Posts: 3
Joined: Mon Jul 14, 2008 3:01 am UTC

Re: I want to show off for my Mom (and Python won't let me!)

Postby Shaitan Apistos » Mon Sep 01, 2008 5:11 am UTC

Shoes is probably perfect for what you're trying to do. It's a neat little cross platform gui app framework for Ruby. Homepage at http://www.shoooes.net/


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 8 guests