Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Iterate DictReader in csv.py #351

Open
jvEhrlinger opened this issue Dec 23, 2024 · 0 comments
Open

Unable to Iterate DictReader in csv.py #351

jvEhrlinger opened this issue Dec 23, 2024 · 0 comments

Comments

@jvEhrlinger
Copy link

Hello, I'm attempting to use the CSV module with MicroPython, and am hitting a wall when trying to instantiate a DictReader.
The relevant code region follows..

def getServiceID():
    # so, let's start by pulling the date and getting a dictionary of all of our trips.
    theDate = strftime("%Y%m%d", t.localtime())
    # grab our service id for the day
    with open('sd/gtfslirr/calendar_dates.txt', newline='') as dateFile:
        dateReader = csv.DictReader(dateFile)
        for row in dateReader:
            if row['date'] == theDate:
                service_id = row['service_id']
                return service_id

and the accompanying error...

Traceback (most recent call last):
  File "boot.py", line 173, in <module>
  File "boot.py", line 144, in main
  File "boot.py", line 46, in getServiceID
  File "csv.py", line 149, in __next__
  File "csv.py", line 52, in __next__
AttributeError: 'match' object has no attribute 'groups'

Line 46, in this case, being dateReader = csv.DictReader(dateFile)

Thank you for maintaining the module, and please let me know if you have any insight into why I might be experiencing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant