Unicode error running Count Trips at Stops

2031
12
Jump to solution
10-31-2018 06:40 AM
Labels (1)
AlexHanson
New Contributor II

Hi,

I am trying to run the Count Trips at Stops tool within BetterBusBuffers (v. 0.13.0.2) but keep getting a unicode error. I have used the tool successfully before but started getting this error within the last week. I have already successfully pre-processed the GTFS data into a SQL database. Error message below. I'm running ArcGIS 10.4.1 for Desktop with a basic license. 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
AlexHanson
New Contributor II

Hi Melinda,

Thanks for your always timely responses and all your work on these tools. A

very odd error indeed. Got it to work when I saved it to the desktop and

without any underscores in the file name.

Thanks for your help!

View solution in original post

0 Kudos
12 Replies
MelindaMorang
Esri Regular Contributor

Hello Alex.  This is a very strange error.  The error message tells me that it actually failed when trying to run the Add Field geoprocessing tool.  I don't know why that tool would generate a UnicodeEncodeError while trying to add a field called "stop_id".

What is the name of your output stops feature class?  Does that path have any non-ascii characters in it?  If so, perhaps try again using a path with only standard ascii characters and see if that fixes it.

Another thing to try is creating a feature class with the same name and path as the one you designated with the tool (or using the one the tool created) and manually running the Add Field geoprocessing tool.  Try to add a text field called "stop_id".  If the tool gives you the same error, this is sufficient for you to call Esri Support, and they can diagnose and resolve the issue for you.

AlexHanson
New Contributor II

Hi Melinda,

Thanks for your always timely responses and all your work on these tools. A

very odd error indeed. Got it to work when I saved it to the desktop and

without any underscores in the file name.

Thanks for your help!

0 Kudos
MelindaMorang
Esri Regular Contributor

Could you tell me what your original filepath was?  I'd like to fix the problem so that future users don't run into it, or report it as a bug to the team that owns the Add Field tool.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Validating table and field names in Python—ArcPy Get Started | ArcGIS Desktop 

would be a easy addition and is available already

AlexHanson
New Contributor II

When it wasn't working filepath was: M:\_2018\3 CHI\18-03-4660 Chariot

Unsolicited Proposal Development – Chicago\Analysis\Last_mile\count_stops

It worked when I

used:
192.168.16.7\Shared\Office-Chicago\Staff_Folders\Hanson,

Alex\Chariot Chicago\CTA_trips

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

\u2013, from your error message, is the Unicode code point for the 'en dash.'  Looking at your original path, I am guessing the hyphen in front of Chicago is really a en dash and not a hyphen.  Try changing that en dash to a hyphen, and I am guessing it will work fine.

0 Kudos
ALEXBARTZOKAS
New Contributor II

Hi! I'm also dealing with a similar error when I run the Count Trips at Stops tool. I'm running ArcGIS 10.3.1 for desktop, and the Unicode error I get is the following: 

Executing: CountTripsAtStops C:\Users\alex_\Desktop\test\test1.gdb\testdusseldorf C:\Users\alex_\Desktop\test\gtfsdusseldorf022019c.sql 20190205 06:00 20:00 Departures
Start Time: Fri Feb 08 23:57:41 2019
Running script CountTripsAtStops...
Creating feature class of GTFS stops...
Calculating the number of transit trips available during the time window...
Writing output data...
Error writing to output.
Failed to count trips at stops.

Traceback (most recent call last):
File "<string>", line 163, in execute
File "C:\Users\alex_\Desktop\D4i_Paper_Metro\BetterBusBuffers\BetterBusBuffers_0.13.0.2\BBB_CountTripsAtStops.py", line 98, in runTool
[str(row[0])], stoptimedict, CalcWaitTime,
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 25: ordinal not in range(128)

Failed to execute (CountTripsAtStops).

The GTFS dataset I used as an input is accessible here.

I tried to change the file path or the file name, but it didn't work.

Any ideas for possible solutions?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I followed the link you provided to the data; however, I did not download dusseldorf data but verbundweit data.  Also, there was no *.sql file in the zip archive I downloaded either.

Looking at the specific error, you are dealing with:

>>> import unicodedata
>>> unicodedata.name(u'\xfc')
'LATIN SMALL LETTER U WITH DIAERESIS'
>>> 

Now that you know what the problem character is, you should be able to address it. 

0 Kudos
MelindaMorang
Esri Regular Contributor

I downloaded the data from your link (Fahrplandaten Februar 2019).  I was not able to even run it through the Preprocess GTFS tool because I get the following error:

stop_id "de:05112:16284:0:3" in E:\GTFS\Dusseldorf\stops.txt contains an invalid non-numerical value for the stop_lat field: "". Please double-check all lat/lon values in your stops.txt file.

How did you get as far as you did? Did you modify the GTFS, and if so, can you post your modified version?

0 Kudos