Re: File Lock
Jeff Mitchell <[email protected]> Fri, 13 Sep 2019 16:31:27 -0400
| Newsgroups | gmane.comp.lang.jython.user |
|---|---|
| Message-ID | <CAAdVdyjARsW7OPMK74TVo3WULyP4ujsAKUBR6pdGkeL7SppsmA@mail.gmail.com> |
--===============6635005924068828134== Content-Type: multipart/alternative; boundary="0000000000001e8268059275240b" --0000000000001e8268059275240b Content-Type: text/plain; charset="UTF-8" Its hard (in an OS independant fashion) to know if a file is _open_, but its a little easier to tell if it is _locked_, which is the same for you likely. (If a job opens a file without locking it, then you couldn't easily detect it.) Without creating your own file locking scheme, or looking into the OS specific flock functions, you could just take a look at.. https://pypi.org/project/filelock/2.0.13/ On Fri, Sep 13, 2019 at 4:26 PM Pete via Jython-users < [email protected]> wrote: > I need to append and then close a file. > > I am trying to avoid file write contention issues. > > How can I determine if the file if not closed before opening it for append? > > > Thank you, > > PR > > > > _______________________________________________ > Jython-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jython-users > --0000000000001e8268059275240b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Its hard (in an OS independant fashion) to know if a file = is _open_, but its a little easier to tell if it is _locked_, which is the = same for you likely. (If a job opens a file without locking it, then you co= uldn't easily detect it.)<div><br></div><div>Without creating your own = file locking scheme, or looking into the OS specific flock functions, you c= ould just take a look at..</div><div><br></div><div><a href=3D"https://pypi= .org/project/filelock/2.0.13/">https://pypi.org/project/filelock/2.0.13/</a= ><br></div><div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"= ltr" class=3D"gmail_attr">On Fri, Sep 13, 2019 at 4:26 PM Pete via Jython-u= sers <<a href=3D"mailto:[email protected]">jython-users= @lists.sourceforge.net</a>> wrote:<br></div><blockquote class=3D"gmail_q= uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2= 04);padding-left:1ex">I need to append and then close a file.<br> <br> I am trying to avoid file write contention issues.<br> <br> How can I determine if the file if not closed before opening it for append?= <br> <br> <br> Thank you,<br> <br> PR<br> <br> <br> <br> _______________________________________________<br> Jython-users mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">Jyt= [email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/jython-users" rel= =3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi= nfo/jython-users</a><br> </blockquote></div> --0000000000001e8268059275240b-- --===============6635005924068828134== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============6635005924068828134== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Jython-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jython-users --===============6635005924068828134==--