python script works in pywin but not in command window

Reply

Join Date: Nov 2008
Posts: 2
Reputation: gab_sk is an unknown quantity at this point 
Solved Threads: 0
gab_sk gab_sk is offline Offline
Newbie Poster

python script works in pywin but not in command window

 
0
  #1
Nov 12th, 2008
Hi,

I have a python script which uses a COM object. This script works correctly when I run it from pywin, however, it does not run when I run it from windows command line - it throws an exception occurred in this COM object.
I know that this COM obj. exception is also thrown when call is made from C++ code, but this can be avoided when some specific resource is added to C++ project (after project rebuild it works).
I don't know how to achieve the same effect (as with C++ solution) with python and also I don't know what pywin is doing differently so that this code works there.

Any help is appreciated.

Thank you.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,010
Reputation: jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough 
Solved Threads: 245
Sponsor
jlm699's Avatar
jlm699 jlm699 is offline Offline
Knows where his Towel is

Re: python script works in pywin but not in command window

 
0
  #2
Nov 12th, 2008
Can you provide some code to demonstrate the problem? It will be much easier to understand the problem
1. Use Code Tags.
2. Homework? Show Effort.
3. Keep discussions on the forum: no PMs
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 2
Reputation: gab_sk is an unknown quantity at this point 
Solved Threads: 0
gab_sk gab_sk is offline Offline
Newbie Poster

Re: python script works in pywin but not in command window

 
0
  #3
Nov 12th, 2008
This is the code, very short and simple, exception occurs in login.ValidateUser(). When I run this in pythonwin, process id is printed in interactive window, so it works as expected.

import win32com.client

login = win32com.client.Dispatch("ACDB.Login")
login.Login("","")
login.ApplicationName = "whatever"
login.Version = "1.0"
login.ValidateUser("Sunrise.fxb")
print login.ProcessID
Last edited by gab_sk; Nov 12th, 2008 at 8:04 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,010
Reputation: jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough 
Solved Threads: 245
Sponsor
jlm699's Avatar
jlm699 jlm699 is offline Offline
Knows where his Towel is

Re: python script works in pywin but not in command window

 
0
  #4
Nov 12th, 2008
Can you also post the traceback of the exception?
1. Use Code Tags.
2. Homework? Show Effort.
3. Keep discussions on the forum: no PMs
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC