Christoph Basedau wrote:

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.

No, Win9x does not allow arbitrary filetypes to be labeled as executables. Your *.py files will always need to be invoked by 'python *.py' -- though you can get the Windows Explorer to do this automatically when double-clicking a .py file. (Note that you *can* make .py files executable in WinNT/2k/XP, as a previous respondent noted, and ActivePython does so by default. This is due to limitations of the Win9x interactive shell, which is the same shell used by DOS [command.com] -- the WinNT codebase uses an entirely different interactive shell [cmd.exe] which does not have this limitation.)

- 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?

Environment variables can be set in your autoexec.bat, or you can create a batch file 'mypython.bat' which invokes python with specific options -- and you can even change the filetype association for .py files to point to your batch file instead of directly to the python interpreter.

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

Yes.   (I use it for all of the above, and more.)

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

Try the Vaults of Parnassus (www.vex.net/parnassus) for generally useful scripts and tools, and Useless Python (www.uselesspython.com) for a great beginner-oriented site.

- 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?

Yes, the win32com extension will allow you to use any COM automation objects -- essentially, the same ones that you would use from Visual Basic. You can also drive the Windows Scripting Host from python. One caveat -- there are some things for which python pretty much requires having a type library, and python's handling of in/out parameters is somewhat different, but it's pretty easy to learn to translate VB/VBS calls into Python calls.

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

 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?

I think the problem here is that PythonWin (the IDE) doesn't deal well with multi-line pasting in the interactive window. That window operates in a very line-oriented manner, and giving it several lines at once seems to confuse it. If you simply retype the code in the interactive window, it should work fine. Alternatively, you can paste the code into a script window, and then save and run the script.

Jeff Shannon
Technician/Programmer
Credit International


_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to