By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,199 Members | 1,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,199 IT Pros & Developers. It's quick & easy.

pythonwin closes unexpectedlyI

P: n/a
Hi,

I run a script in PythonWin and obviously some sort of an error occurs
in the script and PythonWin closes. No warning, no error message just
closes. I definitely know the line of code that causes the problem and
will cite the code below.

Note: I'm using ArcGIS 9.1 (Python 2.1 is bundled with it) and
trying:p to write a script. I know this works OK at work but on my
home system the problem occurs. I'm suspicious that maybe file sharing
permission problems are the cause. But I can't get any error messages
to even start figuring it out. Using WinXP.

When the 2nd raw_input box opens ( GP.workspace = raw_input('workspace
path: ') and I enter the path and click Ok that's when PythonWin
closes. Here's code:
import win32com.client, sys, os

GP = win32com.client.Dispatch("esriGeoprocessing.GpDisp atch.1")

print 'I am in the program' # this works OK

test001 = raw_input('workspace path: ')

print test001 # this works OK

try:

GP.workspace = raw_input('workspace path: ')

except:

GP.AddMessage(GP.GetMessages(2))

print GP.GetMessages(2)

Jun 3 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Jun 3, 10:50 am, leegold <goldt...@worldpost.comwrote:
Hi,

I run a script in PythonWin and obviously some sort of an error occurs
in the script and PythonWin closes. No warning, no error message just
closes. I definitely know the line of code that causes the problem and
will cite the code below.

Note: I'm using ArcGIS 9.1 (Python 2.1 is bundled with it) and
trying:p to write a script. I know this works OK at work but on my
home system the problem occurs. I'm suspicious that maybe file sharing
permission problems are the cause. But I can't get any error messages
to even start figuring it out. Using WinXP.

When the 2nd raw_input box opens ( GP.workspace = raw_input('workspace
path: ') and I enter the path and click Ok that's when PythonWin
closes. Here's code:

import win32com.client, sys, os

GP = win32com.client.Dispatch("esriGeoprocessing.GpDisp atch.1")

print 'I am in the program' # this works OK

test001 = raw_input('workspace path: ')

print test001 # this works OK

try:

GP.workspace = raw_input('workspace path: ')

except:

GP.AddMessage(GP.GetMessages(2))

print GP.GetMessages(2)
Steps to try:

1. Add
raise
after the print statement.
2. Get pythonwin out of the equation; run your script from the command
line.
3. If that doesn't give you a clue what the error is, remove the try/
accept/GP.AddMessage.../print lines and run it again from the command
line.

HTH,
John

Jun 3 '07 #2

P: n/a
snip...

Slight off-topic fix for anyone whose search comes here:

Recommend to patch ESRI application to newest update.

You might also see error message: OLE error 0x80040212

http://support.esri.com/index.cfm?fa...leShow&d=30524

gp.SetProduct("ArcView") is fix

>
Steps to try:

1. Add
raise
after the print statement.
2. Get pythonwin out of the equation; run your script from the command
line.
3. If that doesn't give you a clue what the error is, remove the try/
accept/GP.AddMessage.../print lines and run it again from the command
line.

HTH,
John

Jun 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.