cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4277
Views
5
Helpful
5
Replies

Guestshell open file on flash with Python

nathy1984
Level 1
Level 1

Hello

 

How can I open a file on flash from Guestshell with Python?

Thanks.

5 Replies 5

ngkin2010
Level 7
Level 7
Hi,

As I remember, the absolute path of flash drive is '/flash' in guestshell. Make sure you got at least 'read' file permission, and you could open the file by Python.

fd = open('/flash/filename','r')

It should be '/bootflash' instead of '/flash' as mentioned by @omz

omz
VIP Alumni
VIP Alumni
file = open('/bootflash/test.txt','r')
print file.read()
file.close()

OR
with open('/bootflash/test.txt','r') as file: print file.read()

Thank you for the reply.

That works. Flash or Bootflash depends on the device type.

Please dont forget to rate helpful posts and accept solutions so the post is helpful for other users.

Thank you  

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: