473,383 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

pythonwin closes unexpectedlyI

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
2 2393
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: stephan | last post by:
Hi, I have python 2.2.3 + pythonwin 156 on win2k. The problem is that german chars like äöüÄÖÜß are not handled correctly. Just create a test.py file with the content äöüÄÖÜß and edit it with...
7
by: Martin Bless | last post by:
IMHO PythonWin is great help in developing. How can I do something like: if detect("running on PythonWin"): pass # fake arguments ... else: "proceed normal"
3
by: Alberto Mantovani | last post by:
hi, how is it possible to run a python script in the pythonwin environment from dos command line? If I use the command "/run scriptname.py" and the pythonwin is already opened I get error, so...
14
by: Jive | last post by:
I've un-installed Python 2.4, re-installed Python 2.3 and PythonWin for 2.3, but it's still broke. When I start PythonWin, sometimes it looks like it is going to be okay. But as soon as I open...
4
by: Chris P. | last post by:
I've been having a problem with PythonWin that seemed to start completely spontaneously and I don't even know where to START to find the answer. The only thing I can think of that marks the point...
2
by: siggy2 | last post by:
Hi All, (sorry for my bad english) I wrote a __tiny__ and __stupid__ recursive script directly into pythonwin interactive window with a time.sleep(1) and a print before each recursion... I...
2
by: accolades | last post by:
Does anyone else have a problem with Pythonwin crashing after running a python script with graphics libraries? Whenever I use Pythonwin to run a PyGame or PyOgre script, Pythonwin crashes when the...
17
by: Dave Benjamin | last post by:
Hey folks, Why is PythonWin (win32all) still a separate download from a third party? Is it legal, technical, or what? I think it's about time it be part of the standard distribution. There...
3
by: archaegeo | last post by:
I am getting started in Python, and I have looked on both the stackless page and python.org and cannot find the answer to what I think is a simple problem. If I start the python command line or...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.