469,282 Members | 1,637 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

What is the path to a Virtual Memory file created in python?

I'm trying to create a virtual XML file, copy some content to it, then access throw parsing, it may be simple, but every path that I'm trying to use ( like 'mem://mem_test.xml' or '{}'.format(mem_file) ) are not working... What path should I use to access a file in the Virtual Memory?
Expand|Select|Wrap|Line Numbers
  1.     import fs
  2.     import xml.etree.ElementTree as Et
  4.     mem_fs = fs.open_fs('mem://')
  5.     os_fs = fs.open_fs(".")
  6.     mem_file = mem_fs.open('mem_test.xml', 'rw')
  7.     fs.copy.copy_file(os_fs, 'test.xml', mem_fs, 'mem_test.xml')
  8.     tree = Et.parse('[string with path to mem_test]')
  9.     root = tree.getroot()
4 Weeks Ago #1
0 2468

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Lost Bits | last post: by
5 posts views Thread by Ian | last post: by
3 posts views Thread by Gregor Wind | last post: by
2 posts views Thread by Kevin | last post: by
18 posts views Thread by diffuser78 | last post: by
12 posts views Thread by David Given | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.