I have a file where I want to apply the following regex pattern to the file and save it.
Below is my code:
file = open("/home/hive_db_ddls/abc_db_extract_all_tables.sql","a", encoding='latin-1').read()
for line in file:
re.sub(r'(TBLPROPERTIES \(.*?\))', r'\1;', file, flags=re.DOTALL)
Error I am getting:
Traceback (most recent call last):
File "/home/python_filter.py", line 4, in <module>
file = open("/home/hive_db_ddls/abc_db_extract_all_tables.sql","a", encoding='latin-1').read()
io.UnsupportedOperation: not readable
Any suggestion as to why I am receiving this error? I know it should be a small fix but can't seem to find the problem.