I want to write kind of a log file back to azure adls gen1 I can write (not append) using
dbutils.fs.put(filename,"random text")
but i cant append it using
with open("/dbfs/mnt/filename.txt","a"):
f.write("random text")
it give me error
1 with open("/dbfs/mnt/filename.txt", "a") as f:
----> 2 f.write("append values")
OSError: [Errno 95] Operation not supported
alternatively, i tried using logger.basicconfig(logging.basicConfig(filename='dbfs:/mnt/filename.txt', filemode='w')
but looks like its not writing into the path. can anyone help please
Append Only ('a') : Open the file for writing. The file is created if it does not exist. The handle is positioned at the end of the file. The data being written will be inserted at the end, after the existing data.
file = open("myfile.txt","a")#append mode
file.write("Today \n")
Output of append file:
you can do that to a dbfs file. https://kb.databricks.com/en_US/dbfs/errno95-operation-not-supported
You may need to figure out a logic to read a file from datalake using python cli and write to it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.