On Wed, 16 Feb 2005, Bill Mill wrote:
> > I have several thousand files in dBaseIV format that I need to convert > > to shapefiles for use in ArcGIS. I've written a script (see below) to > > automate this process but thus far have been unable to get it to work. > > I suspect that there's a simple reason for this, but I'm a complete > > novice with Python and have been unable to find it. > > Boil your question down into something smaller, and then ask it with > the appropriate information. I suggest reading > http://www.catb.org/~esr/faqs/smart-questions.html . Hi Chris, Yes, at the moment, without even a clue what kind of problem there is, there's little we can do. We don't have dBase on our system, so the kind of diagnostics we have access to is limited to what you tell us. *grin* We just don't have enough information, and telling us that something is going wrong isn't enough for us to do a good analysis. Let's try pinpointing what you mean by "not working". I notice that your code has the following structure: ### try: ## .. do a bunch of stuff except: gp.AddMessage(gp.GetMessages(2)) print gp.GetMessages(2) ### This is a blanket try/except block that catches everything. This kind of exception handler tends to disguise problems in the code that have nothing to do with dBaseIV. I'm also not sure at all if it's the right thing for the program to ignore the error and try to continue working with the 'gp' object. Try to make exceptional conditions yell out when an exception occurs. That may make it much easier to see the problems at hand. Can you add the following import to your program? ### import traceback ### Also modify the except block to this: ### try: ## .. do a bunch of stuff except: traceback.print_exc() ### These changes use the excellent 'traceback' error-tracing module: http://www.python.org/doc/lib/module-traceback.html and traceback.print_exc() will print out the details of errors that occur in the try block. We have to do what we can to get some useful information what's going wrong, before continuing to work on this problem. Good luck to you! _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor