473,809 Members | 2,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

urgent question, about filesystem-files

i started python programming a few months ago.

now i need the code to understand if a file already opened in
filesystem by another process ?

i looked at docs, howtos, but did not find related info.
note that normal file open/write operations in python, i know it.

i specificly need to know that "is a file already open by some other
process other than python".
Thank you in advance
Apr 10 '08 #1
2 1118
bvidinli wrote:
i started python programming a few months ago.

now i need the code to understand if a file already opened in
filesystem by another process ?

i looked at docs, howtos, but did not find related info.
note that normal file open/write operations in python, i know it.

i specificly need to know that "is a file already open by some other
process other than python".
The pragmatic solution here is to not worry about it and let it be the
user's problem if he does something stupid.

It's OS specific how to get at this information. On Linux, for example
you can call the `fuser` program (if installed; on Ubuntu it's in the
psmisc package). But this will only tell you if the same user has the
file open (or if you're root).

-- Gerhard
Apr 10 '08 #2
bvidinli wrote:
i started python programming a few months ago.

now i need the code to understand if a file already opened in
filesystem by another process ?

i looked at docs, howtos, but did not find related info.
note that normal file open/write operations in python, i know it.

i specificly need to know that "is a file already open by some other
process other than python".
Thank you in advance
This is a OS function. With Linux you use the command lsof (as root). A
Python program can call such a command, but you have to parse the output.
Robert
Apr 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2503
by: Catherine Jones | last post by:
Hi all we are getting active x component can not create object (Error No. 16) while creating an instance of File System Object in ASP client side script. Could you plz help us in solving this problem. We were working on opening a selected text file at client site and inputing the content. I have pasted the same code bellow of which plz find in order. <SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript> <!--
65
5401
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++ language. A C++ interface installation IS ABOUT THE C++ LANGUAGE! The language does not possess the ability to handle even simple file directory manipulation. Those wise people that created it did not take care of it. So, BOOST is a portable...
3
2281
by: Michael | last post by:
Is this the correct place to ask about Boost libs? If it is.............. #include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> using namespace boost; using namespace boost::filesystem;
3
1111
by: pagates | last post by:
Hi All, This is a pretty simple question, but with possibly a complex answer. I was wondering if anybody had any opinions or links for "rules" as to when to use elements and when to use attributes within XML. For a quick example, think of a file system represented by XML. Method 1: Attributes
8
5272
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is developing a web-based application, one part of which involves allowing the user the ability to page through transaction "history" information. The _summary_ history table will have the following fields: ServiceName, Date, User-Ref1, User-Ref2,...
2
2717
by: Jeff Davis | last post by:
I have virtual hosted users on a server and some of them have a postgresql database. I'm concerned about the outside possibility that a user could create an infinite loop and fill up the partition on which everyone's database resides. Anyway, it occured to me that I could create a special file for each database user of limited size, and make a filesystem on top of that file. The file could be owned by the user. Then, each user could have...
11
2258
by: RoB | last post by:
Hi all, I'm coming from the Informix world and I have a customer using DB2 8.2.3 for Linux on Red Hat Enterprise ES. The customer is performing filesystem backups of the containers etc every night but they are not shutting down the database server while doing this. I only assume that this most likelly would leave an inconsistant backup image as there is nothing assuring that the modified pages in the buffer pool get written to disk...
77
3912
by: Hans Schneider | last post by:
1. in the prg bellow what vars are stored on stack, heap, data segment? int i; void main() { int j; int *k = (void *)malloc(1); }
3
2455
by: william.david.anderson | last post by:
Hi there, I have a newbie question about backing up our database on our Solaris system. I was reading the "Data Recovery and High Availability Guide and Reference", but didn't see any references to using filesystem snapshots to backup a database.
4
201
by: meenu_susi meenu_susi | last post by:
hi all Could you please help me out i creating folder using vbscript.. I have used the following code... <SCRIPT LANGUAGE="VBScript"> <!-- Option Explicit
0
9601
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
10635
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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
10378
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
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5550
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...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
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.