Disable dbutils.fs.put() write to console "Wrote x bytes"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 01:22 PM
Hey all, does anyone know how to suppress the output of dbutils.fs.put() ?
- Labels:
-
Disable
-
Output
-
Wrote Bytes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 09:28 PM
what mean by suppress , can you please share code block
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2023 07:22 PM
write dbutils.fs.put('abfs://some_address_to_some_abfs_location_you_have/helloworld.txt','Hello World',True) and notice that it outputs "Wrote X bytes." to the console stdout. I don't want "Wrote X bytes" to be written to the console.
You can suppress dbutils.fs.put()'s output by setting sys.stdout = open("/dev/null","w") and just writing it out somewhere useless, but this doesn't work in a threaded application.
I could suppress the output by getting rid of sys.stdout like above, and then use logging, and write warnings, but I'd rather not have a warning written as I'm using warnings and errors for other purposes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2023 11:14 PM
Hi @Jordan Fox
Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.
We'd love to hear from you.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 09:32 PM
No, have not resolved the issue. Still Wrote 105783245 bytes. If dbutils.fs.put(), which is:
put(file: String, contents: String, overwrite: boolean = false): boolean -> Writes the given String out to a file, encoded in UTF-8
Could instead be:
put(file: String, contents: String, overwrite: boolean = false, verbose: boolean = true): boolean -> Writes the given String out to a file, encoded in UTF-8, defaults message to stdout unless verbose=false
That would be great.
![](/skins/images/8C2A30E5B696B676846234E4B14F2C7B/responsive_peak/images/icon_anonymous_message.png)
![](/skins/images/8C2A30E5B696B676846234E4B14F2C7B/responsive_peak/images/icon_anonymous_message.png)