473,686 Members | 3,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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
  3.  
  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()
  10.  
Sep 19 '21 #1
1 8808
Vanisha
25 New Member
In Python, the path to the Virtual Memory file depends on the operating system being used.

On Windows, the Virtual Memory file is typically located at C:\pagefile.sys .

On Linux, the Virtual Memory file is typically located at /swapfile.

In general, you can use the os module in Python to obtain information about the Virtual Memory file. For example, to obtain the path to the Virtual Memory file on Linux, you can use the following code:
import os
path = os.path.realpat h('/proc/swaps')

This will return the absolute path to the swaps file, which contains information about the swap space being used on the system.
If you're looking to improve your coding skills or learn new technologies, join Cetpa Infotech.
Check out our website for more information.
Feb 22 '23 #2

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

Similar topics

4
4352
by: Lost Bits | last post by:
Hello there C++ pros.. Well, I have recently redesigned an already existing piece of code that someone else designed - its just a search algorithm they developed, and has to perfomr millions of loops depending on the data input.. My problem is that my code can be upto 10 times slower than the previous persons - and speed is very critical. (and I dont mean setting up the arrays takes long, I'm more concernted about the speed
5
3668
by: Ian | last post by:
I have and Access 97 DB that prints a report that has many pages, sometime about 800-1000 page, each page contains a colour picture along with text boxes. The pictures are displayed on the report but the DB only stores the path to the picture. On the reports detail sections On Print event I have the code (.Picture = ). Image path is the field that store the picture location. My problem is that when I send this report to the printer,...
3
10590
by: Gregor Wind | last post by:
Hello all, for my image processing application I need a large amount of virtual memory. I read, that it is normaly possible to get 2GB of virtual memory for each process and when you modify the boot.ini file it should be possible to get 3GB vitual memory for one process. I have tried to allocate nearly 2GB in my application, but I receive the SystemOutOfMemory Exception. It is only possible to allocate a little bit more than 1GB. I...
10
3809
by: VM | last post by:
How can I limit the use of the PC's virtual memory? I'm running a process that basically takes a txt file and loads it to a datatable. The problem is that the file is over 400,000 lines long (77 MB) and after a while I get the Windows message saying that the virtual memory's getting really low. Plus the machine gets really sluggish (with multi-threading). Is it possible to use the virtual memory until it reaches a certain limit and then use...
0
1379
by: Rob | last post by:
hi! i am running a aspnet-application on a machine with 1 gb ram. looking into the taskmanager, the aspnet_wp-process is going to use up to 60 megs heap memory and about 55 megs virtual memory. also there are up to 500 changes in pagefaults per second. the cpu-usage of aspnet_wp is varying between 25 and 95 percent. the taskmanager told me, there are about 700mb heap memory available. the memorylimit-value in my machine.config-file is...
2
2806
by: Kevin | last post by:
i have a python file called pyq which outputs stock quotes, currently i also have a html file that takes stock ticker inputs, i would like to bridge the two by building another program that takes the html inputs and uses them to call the pyq stock ticker program and then output them into a text file... any idea how to do this? my tentative code is:
18
2931
by: diffuser78 | last post by:
I have a python code which is running on a huge data set. After starting the program the computer becomes unstable and gets very diffucult to even open konsole to kill that process. What I am assuming is that I am running out of memory. What should I do to make sure that my code runs fine without becoming unstable. How should I address the memory leak problem if any ? I have a gig of RAM. Every help is appreciated.
6
10719
by: zissop | last post by:
Hello I have a strange situation with my ASP.Net applications running on Windows 2003 Server x64. As soon as they get instantiated (a visitor hits a page). the virtual memory they allocate goes to something around 5GB! I can't explain the reason. I even made a very simple page (no Web.config, no global.asax, just text output) and it behaves the same. The applications uses 3 tier architecture with all (IIS, component, etc) running at 64...
12
2993
by: David Given | last post by:
I have a situation where I need to be able to allocate chunks on unmapped virtual memory. Because the memory I'm allocating isn't mapped, I can't use a normal memory allocator, as most of them want to store their metadata about the free list in the unused holes in the heap. Instead, I need a memory allocator that stores its metadata out-of-line (perversely enough, a simple malloc() heap would be fine for that). Does anyone know of...
2
1686
by: kittu1208 | last post by:
If we can display the path. Can anyone please explain how?
0
8581
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8514
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8766
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4307
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2944
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.