473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1103
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
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...
65
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++...
3
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...
3
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...
8
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...
2
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...
11
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...
77
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
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...
4
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...

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.