Python Forum
Reading DBF files from Amazon s3 throwing error - 'int' object has no attribute 'isa
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading DBF files from Amazon s3 throwing error - 'int' object has no attribute 'isa
#1
I am developing a python aws lambda function for migrating dbf files into mysql after reading s3 files. .Lambda function get triggered after every dbf file upload to s3. Here is my code,
 import boto3
 import io from dbfread 
 import DBF s3 = boto3.client('s3')
 obj = s3.get_object(Bucket='XXXXXX', Key='test.dbf')
 f   = io.BytesIO(obj['Body'].read())
 for line in f.readlines():    
     for r in DBF(line,encoding='utf-8'):
         # mysql migration process
but when i am executing the script im getting the below error.
File "E:\Projects\dbf_mysql_migration\dbfread\dbf.py", line 108, in __init__
self.filename = ifind(filename)
File "E:\Projects\dbf_mysql_migration\dbfread\ifiles.py", line 55, in ifind
files = iglob(pat)
File "E:\Projects\dbf_mysql_migration\dbfread\ifiles.py", line 44, in iglob
return glob.glob(ipat(pat))
File "E:\Projects\dbf_mysql_migration\dbfread\ifiles.py", line 24, in ipat
if c.isalpha:
AttributeError: 'int' object has no attribute 'isalpha'

Can you please help me? Is there any better way to read dbf files as streams from s3 .
Reply
#2
It would help if you posted a minimal, yet complete code example that demonstrates the problem - the lines in the traceback you've provided don't match with the code you've posted. In any case, it looks like the error is because something that is expected to be a string is actually an int, so you need to work out where that's happening and read the docs for the various functions to see how to use them correctly.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  json loads throwing error mpsameer 8 587 Jan-23-2024, 07:04 AM
Last Post: deanhystad
  Error: audioio has no attribute 'AudioOut' netwrok 3 592 Oct-22-2023, 05:53 PM
Last Post: netwrok
  AttributeError: '_tkinter.tkapp' object has no attribute 'username' Konstantin23 4 1,530 Aug-04-2023, 12:41 PM
Last Post: Konstantin23
  xlwings error when reading a workbook Mishal0488 1 1,037 Aug-01-2023, 02:05 AM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 776 Jul-23-2023, 02:25 PM
Last Post: Fare
  Python: AttributeError: 'PageObject' object has no attribute 'extract_images' Melcu54 2 3,665 Jun-18-2023, 07:47 PM
Last Post: Melcu54
  Object attribute behavior different in 2 scripts db042190 1 685 Jun-14-2023, 12:37 PM
Last Post: deanhystad
  cx_oracle Error - AttributeError: 'function' object has no attribute 'cursor' birajdarmm 1 2,211 Apr-15-2023, 05:17 PM
Last Post: deanhystad
  Pandas AttributeError: 'DataFrame' object has no attribute 'concat' Sameer33 5 5,299 Feb-17-2023, 06:01 PM
Last Post: Sameer33
  WebDriver' object has no attribute 'find_element_by_css_selector rickadams 3 5,776 Sep-19-2022, 06:11 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020