How to check for file lock?

Is there any way to check whether a file is locked without using a try/catch block? Right now, the only way I know of is to just open the file and catch any System.IO.IOException.

PowerShell script to check an application that's locking a file?

Using in PowerShell, how can I check if an application is locking a file? I like to check which process/application is using the file, so that I can close it.

File locking in Linux using C program

I want to create one file from c program and i want use bit long time in my c binary. But i want create file in such way that until my c program finish processing file created and unlock it...

Linux flock, how to "just" lock a file?

In Bash, I'm trying to make a function getLock to be used with different lock names. function getLock { getLock_FILE="${1}" getLock_OP="${2}" case "${getLock_OP}" in ...

Locking an XLSX file for reading and writing with FileInputStream, FileOutputStream, and RandomAccessFile

I have an excel that I want to be locked when each forked process is reading and writing to it. Apache poi requires me to use FileInputStream and FileOutputStream for reading and writing to that...

How to open a word document in Java and wait until user ends editing it

Inside of a Java process, is possible to do the following: Invoke Microsoft Word to open a document Sleep the Java process until the user finishes editing the document When the user "closes" the...

Python: why do I get an error when I import geopandas?

I try to import geopandas in my jupyter notebook. import geopandas as gp and I get the following error: ImportError:...

Cuda Runtime Error cudaErrorNoDevice: no CUDA-capable device is detected

I am using Chainer, Cupy for CUDA 8.0 . I am trying to train machine learning model using python3.5 script, but I got this error: cupy.cuda.runtime.CUDARuntimeError: cudaErrorNoDevice: no...

WEBP support not installed error with Pillow included in Anaconda

I have written a small code to open webp image in the Anaconda prompt. from PIL import Image im = Image.open('test.webp') It causes the following...

"AssertionError: Torch not compiled with CUDA enabled" in spite upgrading to CUDA version

I figured out this is a popular question, but still I couldn't find a solution for that. I'm trying to run a simple repo Here which uses PyTorch. Although I just upgraded my Pytorch to the latest...

ERROR: You must give at least one requirement to install -- when running: pip install --upgrade --no-binary hdbscan

I am trying to install hdbscan in my PC which runs Windows 10 and has installed Python 3.6. My first attempt failed: (base) C:\WINDOWS\system32>pip install hdbscan --user Collecting hdbscan ...

OpenCV-python not importing

I am using Pydroid to code in android. Though it is an ARM machine so I downloaded OpenCV-python wheel from PiWheels and successfully installed it using pip. But i can't import OpenCV anyways....

Hyperledger Fabric: Peer Node Rollback

I am following Hyperledger V 1.4 documsation to roll back the channel mychannel to block number 150 using this following command: peer node rollback -c mychannel -b 150 If I run this inside...

Python RuntimeError: failed to find interpreter for Builtin discover of python_spec='ackages.venvs/lpthw'

I was following "A Project Skeleton" from "learn python 3 the hard way" and this error occurred. I still don't know what are these actually, just following the steps. So why this problem and how...

Trouble installing turbodbc

I am attempting to install turbodbc on my Ubuntu 20.10 machine. My specs are as follows: pip 20.2.4, Python 3.8.5 , gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0 I have attempted the solutions provided in...

can't install python pacakges

I was installing the package "transformers" and its dependencies. pip install transfomers Collecting transformers Downloading...

Using apache-airflow-providers-snowflake on airflow (no module named Snowflake)

I have installed package apache-airflow-providers-snowflake on airflow on docker and i am getting error No module named Snowflake Please refer attachment (check the error mentioned for the...

NameError: name '_mysql' is not defined -- On airflow start in MacOSX

There are numbers of articles on the titled question but none of them worked for me. The detailed error is as follows: Traceback (most recent call last): File...

Azure cloud-init: Failed to install packages

I have a simple cloud-init file: #cloud-config package_upgrade: true packages: - symlinks - wget - rsync - git but it is failing for my Azure (log provided at the end). This is the first...

Error "Failed to initialize virtualenvwrapper." (WSL Windows 10)

Intro In my WSL (Wsman Shell commandLine, version 0.2.1) on Windows 10, I got pyenv installed and try to use pyenv-virtualenvwrapper. Yet, I can't seem to get it up and running, not even with the...

Token cache serialization in MSAL.NET is not working

I am facing some issues when trying to serialize the tokencache, returned from authenticating with MSAL. I would appreciate any help, since i don't really understand what i am doing wrong. Here is...

Java: How to hold off read/writing a file while it's locked

I have a number of separate applications (all written in Java) that need to access a file for short periods of time. Some of these processes will need read access while others will need to update...

python packages not being installed on the virtual environment using ubuntu

I have a requirements.txt file which holds all information of my python packages I need for my Flask application. Here is what I did: python3 -m venv venv source venv/bin/activate sudo pip...

pathlib: cannot import name 'Sequence' from 'collections'

It has been a few days since I rebuilt my project but when I was testing some things this morning I wanted to update my Werkzeug package due to an issue I was having with its Multidict class, I...

'pipenv' is not recognized as an internal or external command, operable program or batch file

I am a beginner in python so please be gentle and if you do have an answer please provide details. I just installed the most recent python version 3.10 after making sure to delete all previous...

heroku failing to process requirements.txt "because these package versions have conflicting dependencies."

I have deployed this project many times before successfully and have made no changes to the requirements.txt file located in the root directory of the project, however. Heroku will no longer...

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway

I try to use library cv2 for changing picture. In mode debug I found out that problem in function cv2.namedWindow: def run(self): name_of_window = 'Test_version' image_cv2 =...

Huggingface: NameError: name 'pipeline' is not defined

I try to execute the standard intro example from the HuggingFace documentation in a Jupiter notebook: from transformers import pipeline classifier = pipeline("sentiment-analysis") classifier("I've...

pycharm error happening at random time: Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

I am working with pycharm community on a tensorflow model with keras backend, sometimes this error appears in a random time, specially after I call pyplot and close the window: Exception ignored...

SyntaxError: future feature annotations is not defined

I am try to run code sh run.sh and it showed me the error File "/anaconda3/envs/_galaxy_/lib/python3.6/site-packages/filelock/__init__.py", line 8 from __future__ import annotations ...

Relevant tags