config for python on win98

2003-01-11 Thread Christoph Basedau
Hello

I am just starting with python and have some questions.

- Is there a way to make *.py-Files executables in an
  Win98-Environment (like *.bat or *.com).
  I am reading the docs from python.org but most notes on system
  config are for unix, so i couldn't find the answer there.

- is there somethin like a .profile-file(unix) for windows
  that loads all default modules/options when running a py-
  script, maybe a bat/ini file?

- What is python best in? I mean, what do you use it for:
  shell scripts, building guis, something else?

- what is the best way to get an overwiew on what python
  is, what the modules do.

- where on the web can i find lots of python scripts for windows
  with lots of comments suited for dummies and newbies?

- if you know 'windows scripting' with vbs, js, wsf and so on
  will it be easy to port your scripts to py? does the COM-extension
  support the same subset of objects, classes and so on like wsh?
  or is it a differnt story?

- In the docs (py2.3.1) there is an example with strings
  multiline (3.2.1 in Tutorial):

 hello = "This is a rather long string containing\n\
 several lines of text just as you would do in C.\n\
 Note that whitespace at the beginning of the line is\
  significant."

 print hello

  this doesnt work for me, when i paste the code to the
  Python IDE (ActiveState): Error: name 'hello' is not defined
  what do i have to do to  print hello?

thanks for your ansers+time
Christoph

--  
"War does not determine who is right - only who is left."
Bertrand Russell
___
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython




Re: config for python on win98

2003-01-11 Thread Michael C. Urban
On Sat, Jan 11, 2003 at 03:52:57PM +0100, Christoph Basedau wrote:
> 
> - Is there a way to make *.py-Files executables in an
>   Win98-Environment (like *.bat or *.com).

You can't produce a truely self contained exectuable, but you can
produce a package that changes your file to an EXE and wraps the
python interpretor into a DLL file. It can make distribution easier
since end users don't need Python installed that way. Check out

http://starship.python.net/crew/theller/py2exe/ 

for info.

Gordon McMillan's installer
(http://www.mcmillan-inc.com/install1.html) is another possible
solution.

> 
> - is there somethin like a .profile-file(unix) for windows
>   that loads all default modules/options when running a py-
>   script, maybe a bat/ini file?

You can start a python script from a batch file that calls the
interpretor. This is one way to get around the fact that Windows has
nothing like "#!/usr/local/bin/python" at the top of the python script
and no way to make a python script directly executable. Also,
variables that would be set in .profile in UNIX should probably be set
in autoexec.bat in Windows 98.

> 
> - What is python best in? I mean, what do you use it for:
>   shell scripts, building guis, something else?

The real answer to this question is "Python is best for whatever
you want to use it for." Seriously, Python is so flexible that it has
been used in just about every problem domain you can think of. CGI
scripts, database programming, GUI frontends to databases, standalone
GUI applications, science and engineering, image processing (with the
Python Imaging Library). But if you want to know what I use Python for
mostly?

I use it mostly for rapid development of scientific applications. If you
write your code in modules, you can later replace bottleneck ones with
modules written in C or C++. Since Python accesses native Python
modules and C and C++ modules the same way, the C and C++ modules can
basically be drop in replacements. The only noticable change is an
increase in speed. Many of the applications I write have GUI front
ends, either using Tkinter or WxPython.

> 
> - what is the best way to get an overwiew on what python
>   is, what the modules do.

One way is with the command: print modulename.__doc__

This will give you a basic overview of what the module does. Note that
the module must be imported for this to work.
> 
>  hello = "This is a rather long string containing\n\
>  several lines of text just as you would do in C.\n\
>  Note that whitespace at the beginning of the line is\
>   significant."
> 
>  print hello

This should work, and does work on my system. The only advice I can
give you here is to make sure you have typed it exact. Variable names
are case sensitive and such. Also, make sure that the statements start
on the first column. Python used indentation delimitting code blocks,
so if your code starts in the wrong column, it will cause an error.
(The second, third, and fourth lines of the hello statement don't have
to though because they are part of the same statement).

---
"The fingerprint of God is often a pawprint"
- Susan Chernak McElroy
___
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython