Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3334640
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:55:39+00:00 2026-05-17T23:55:39+00:00

On my job, I am working with a big .NET application which writes to

  • 0

On my job, I am working with a big .NET application which writes to a log file. Let’s call the application CompanyApplication. I have written a simple Python script which clears the log:

file_object = open('C:\\log.txt', 'w')
file_object.write("")
file_object.close()

When CompanyApplication.exe is not running this works fine. However, when CompanyApplication.exe is running I get this error:

Traceback (most recent call last):
File “deleteLog.py”, line 1, in <module>
file_object = open(‘C:\log.txt’, ‘w’)
IOError: [Errno 13] Permission denied: ‘C:\log.txt’

This must be because CompanyApplication holds a lock on the log file. Is there any way I can “unlock” the log file, clear it, and then “hand the lock back” to CompanyApplication? I would prefer a solution which could be automated (that’s why I wrote the Python script in the first place).

Additional info: There is only so much I can do to change CompanyApplication itself. I am using Windows XP Pro. I have administrator privileges.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:55:39+00:00Added an answer on May 17, 2026 at 11:55 pm

    You need to fill out the FileShare parameter for the open call on the log file in your .NET program.

    Specifically you will want to allow read/write sharing.

    Depending on how your .NET application works when writing to the log though, what you are suggesting might not work as expected and may cause problems with the .NET program.

    You could simply start a thread in the .NET program which creates an event and waits on it. Later you can set that event from your Python program and the .NET will safely clear it’s own log file and reset the event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a job interview tomorrow for a .NET shop. For the past few
So I'm getting a new job working with databases (Microsoft SQL Server to be
My day job includes working to develop a Pascal-like compiler. I've been working all
At my current job I've been working on making web apps with Java, Tapestry,
In my last job we ended up rewriting the complete ASP.NET stack (forms, controls,
I have a cron job on an Ubuntu Hardy VPS that only half works
I just started working at a company that doesn't have any kind of source
I have been working with C# for many years, since beta. I am having
I am working with PHP code in my job, and some of it is
My job would be easier, or at least less tedious if I could come

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.