[Tutor] COM server not starting

Adolfo Aguirre adolfo158@yahoo.es
Thu, 20 Jun 2002 03:32:47 +0200 (CEST)


Hi:

I intalled Python 2.2.1 and followed instructions for
starting the COM server as found on a downloaded
manual. It did not work. 
Comments:

1. The pages listed on the manual to firt start, and
then test the COM Server where not located where the
manual placed them.

2.  The Manual I am using is called "Python and
ActiveX Scripting" and below I include the text (only
a page)with the instructions I followed.

Adolfo

======>>>>

Python and ActiveX Scripting 

Important: The installers install (not register) the
new implementation. See Installing the AXScript
Implementation for details on setting up the new
implementation. 

This documentation covers the following topics: 
•	What is ActiveX Scripting? 
•	Why a new implementation? 
•	Installing the AXScript Implementation. 
•	Using the AXScript Implementation 
•	Debugging PyScript Code 

What is ActiveX Scripting? 
ActiveX Scripting is a technology which allows for
"plug-in" languages to be used by a host application.
Currently, the only hosts which support this
technology are provided by Microsoft - the best known
ones being Internet Explorer (V3 or better), and
Active Server Pages (aka Denali). 
To test or play with ActiveX Scripting, you will need
one of these hosts. 

Installing the AXScript Implementation. 
Note 
Please see the README.HTM in the win32com directory.
It contains a link to the "AXScript Demos" page. This
page allows you to automatically install the engine 
But here are the "manual installation" instructions. 
Installing either win32com or Pythonwin will install
the new implementation. All you need to is register
it. Perform these steps: 

•	Locate the win32com directory in Windows Explorer.
Change to the "win32com\AXScript\Client" directory. 
•	Locate the file "pyscript.py", and double-click on
this file. This should cause a "Python.exe" window to
appear, and a message appear telling you the server is
being registered. (All that need be done here is to
run "python.exe pyscript.py", which is what the above
procedure will do. However, you can execute that
command how-ever you like!) 

Then test it: 
•	Locate the "win32com\AXScript\Demos\ie" directory. 
•	Double-click on the "foo2.htm" file. You should see
Internet Explorer start up, and all buttons with text.
If any buttons are blank, it is likely that the server
is not correctly registered. (NOTE: If a "Debug
Window" appears minimised on your task-bar, it means
you are running the old implementation.) 
•	Click on the buttons. 

Using the AXScript Implementation 
The language name is "Python". 
The object model provided to Python is very similar to
that provided by VBScript or JScript. All global
functions (such as "alert()" in IE) are available, and
all objects are available by name (eg "MyForm" is used
to reference the form defined with that name in the
HTML. 

Python and Internet Explorer 
Python and IE work very well together. However, a key
difference to the JScript/VBScript implementations is
in "local variables". All objects are able to be fully
referenced, but not all objects are available as
"local variables". For example, in an event handler
for a form, you would expect the forms objects (eg,
buttons, text boxes, etc.) to be visible locally - ie,
you would expect "Text1.Value = 'New Value'" to work -
it doesn't! However, the explicit
"FormName.Text1.Value" does. 
Python and Active Server Pages (Denali) 
To use Python in Active Server Pages (Denali) you must
ensure the .ASP files are installed in a location
known to the Internet Server. 
There is a significant limitation when using scripts
enclosed with <% tags. The current version of Denali
strips all white-space from this code, making it
impossible to write "if" (or any other block)
statements in this context. Code that uses the <SCRIPT
Language="Python" RunAt="Server"> tag works as
expected. 
It should be noted that a design decision in Denali
makes it hard to mix and match the 2 styles. All code
in <% tags is executed before <SCRIPT tags, regardless
of their position in the source file. 
Debugging PyScript Code 
Debugging this code can make life interesting! Future
releases will support the Active Script Debugging
interface, but for now we must use other means. (Note
that this release nearly supports AXDebugging - in
fact, it looks exactly like it does - don't be
fooled!) 
Neither Internet Explorer or Denali have a good place
for Python "print" statements to go! To make matters
worse, Denali is usually run in an environment where
creating a window for such output is not possible. 
To solve this problem, a module called win32trace has
been written. This module allows one Python process to
generate output via a "print" statement, and another
unrelated Python process to display the data. This
works even if the Python process generating the output
is running under the context of a service, as Denali
does. 
To enable this debugging, simply "import
win32traceutil" at the start of your script (ie, in
the .HTM or .ASP file) - thats it! To actually see the
output as it is produced, start a DOS prompt, and run
the file "win32traceutil.py" (eg, "python.exe
win32traceutil.py") This will print all output from
all other Python processes (that have imported
win32traceutil) until you kill it with Ctrl+Break!) 
For further details, please see the win32trace
documentation for more details. 
 
•	For questions about Python and ActiveX Scripting,
send email to MHammond@skippinet.com.au (Mark
Hammond). 
Installing the AXScript Implementation. 
Note 
Please see the README.HTM in the win32com directory.
It contains a link to the "AXScript Demos" page. This
page allows you to automatically install the engine 
But here are the "manual installation" instructions. 
Installing either win32com or Pythonwin will install
the new implementation. All you need to is register
it. Perform these steps: 
•	Locate the win32com directory in Windows Explorer.
Change to the "win32com\AXScript\Client" directory. 
•	Locate the file "pyscript.py", and double-click on
this file. This should cause a "Python.exe" window to
appear, and a message appear telling you the server is
being registered. (All that need be done here is to
run "python.exe pyscript.py", which is what the above
procedure will do. However, you can execute that
command how-ever you like!) 
Then test it: 
•	Locate the "win32com\AXScript\Demos\ie" directory. 
•	Double-click on the "foo2.htm" file. You should see
Internet Explorer start up, and all buttons with text.
If any buttons are blank, it is likely that the server
is not correctly registered. (NOTE: If a "Debug
Window" appears minimised on your task-bar, it means
you are running the old implementation.) 
•	Click on the buttons. 
Using the AXScript Implementation 
The language name is "Python". 
The object model provided to Python is very similar to
that provided by VBScript or JScript. All global
functions (such as "alert()" in IE) are available, and
all objects are available by name (eg "MyForm" is used
to reference the form defined with that name in the
HTML. 
Python and Internet Explorer 
Python and IE work very well together. However, a key
difference to the JScript/VBScript implementations is
in "local variables". All objects are able to be fully
referenced, but not all objects are available as
"local variables". For example, in an event handler
for a form, you would expect the forms objects (eg,
buttons, text boxes, etc.) to be visible locally - ie,
you would expect "Text1.Value = 'New Value'" to work -
it doesn't! However, the explicit
"FormName.Text1.Value" does. 
Python and Active Server Pages (Denali) 
To use Python in Active Server Pages (Denali) you must
ensure the .ASP files are installed in a location
known to the Internet Server. 
There is a significant limitation when using scripts
enclosed with <% tags. The current version of Denali
strips all white-space from this code, making it
impossible to write "if" (or any other block)
statements in this context. Code that uses the <SCRIPT
Language="Python" RunAt="Server"> tag works as
expected. 
It should be noted that a design decision in Denali
makes it hard to mix and match the 2 styles. All code
in <% tags is executed before <SCRIPT tags, regardless
of their position in the source file. 
Debugging PyScript Code 
Debugging this code can make life interesting! Future
releases will support the Active Script Debugging
interface, but for now we must use other means. (Note
that this release nearly supports AXDebugging - in
fact, it looks exactly like it does - don't be
fooled!) 
Neither Internet Explorer or Denali have a good place
for Python "print" statements to go! To make matters
worse, Denali is usually run in an environment where
creating a window for such output is not possible. 
To solve this problem, a module called win32trace has
been written. This module allows one Python process to
generate output via a "print" statement, and another
unrelated Python process to display the data. This
works even if the Python process generating the output
is running under the context of a service, as Denali
does. 
To enable this debugging, simply "import
win32traceutil" at the start of your script (ie, in
the .HTM or .ASP file) - thats it! To actually see the
output as it is produced, start a DOS prompt, and run
the file "win32traceutil.py" (eg, "python.exe
win32traceutil.py") This will print all output from
all other Python processes (that have imported
win32traceutil) until you kill it with Ctrl+Break!) 
For further details, please see the win32trace
documentation for more details. 


_______________________________________________________________
Copa del Mundo de la FIFA 2002
El único lugar de Internet con vídeos de los 64 partidos. 
¡Apúntante ya! en http://fifaworldcup.yahoo.com/fc/es/