cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
647
Views
0
Helpful
1
Replies

Guestshell Python - writing a file to flash

ChrisNewnham_
Level 1
Level 1

Is it possible to write an output file from Guestshell Python directly to flash? I've found I can copy files from the linux CLI (/home/guestshell -> /bootflash), but not write directly from Python itself.

file = open("/flash/guest-share/output.txt", "w")

File "script.py", line 4, in <module>
file = open("/flash/guest-share/output.txt", "w")
PermissionError: [Errno 13] Permission denied: '/flash/guest-share/output.txt'

Even when running the script as sudo. 

Thanks!

 

 

1 Reply 1

From memory the Guest Shell has limited permissions, and writing directly to certain directories like /flash might allowed as you are seeing. Could you write the output file to a dir within the Guest Shell filesystem, and then use the guestshell run command to copy the file to flash?

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Review Cisco Networking for a $25 gift card