Questions tagged [python-os]

The Python os module provides a portable way of using operating system dependent functionality. Use this tag for questions about using the "os" module.

The Python os module provides a portable way of using operating system dependent functionality.

Links

551 questions
1
vote
1 answer

Killing a chrome process by url name using python

I would like to run a python automation that will kill a particular chrome tab, by its url name. For example: if time is 09:00, and url is "www.youtube.com", kill this process. I didn't manage to do it using psutil, with the following code, since I…
1
vote
1 answer

Documentation URL of os module

I'm trying to crack the URL format for Python's os module for use in PyCharm's documentation window. My attempt so far: https://docs.python.org/3/library/os.html#{element.qname} but I'm having trouble displaying documentations such…
Jerry Ajay
  • 1,084
  • 11
  • 26
1
vote
1 answer

Manipulating Dataframes in different sub directories

I have many subdirecotries in which I have unique datasets. I want to do some manipulations on this df individually. Something like: Access to each subdirectory, do manipulation, go to next directory and do the same. For illustrative purposes I can…
1
vote
2 answers

Python: Renaming Files in Directory

I have a dataset of thousands of images downloaded from Kaggle and am wanting to rename the files. The images are all .png images. The current names of the images are all similar to 'Screen Shot 2018-06-08 at 5.08.37 PM.png' and am wanting to just…
1
vote
0 answers

Audio is not merging with video during conversion in Python

I have used a function in python to convert video formats using Imageio and it is working, but the audio in the output video is removed during conversion, is there any way to put the audio back in the output video? import Imageio import os …
Akascape
  • 219
  • 2
  • 11
1
vote
2 answers

How to open a pptx file in powerpoint using python?

I am developing a desktop application that helps users create Powerpoint Presentations. After finishing and saving the .pptx file, is there a way to get it to open in powerpoint so that the user can see the resulting presentation without having to…
1
vote
4 answers

How to check if directory contains another directory named"xyz" in python?

I am trying to figure out how to check (using preferably os module) if one directory contains another directory named "xyz". I have found this solutions: How to check if folder is empty with Python? yet I don't need to check if dir is empty or not,…
Edyficjum
  • 81
  • 6
1
vote
0 answers

Open a file (named pipe) on a distant directory with python, ssh and os.open

For a project I need to open a file (in fact a named pipe) with os.open(). Here is the situation: I have a process that creates two names pipe on a first machine (lets call them pipeCS and pipeSC). Each pipe goes in one direction (pipeCS =…
Nenonymo
  • 11
  • 2
1
vote
2 answers

Want to create a csv inside a folder if it does not exist using string parameter in python

dirLocation = "Patients Data/PatientsTimelineLog.csv" try: if os.path.isfile(dirLocation): print("Directory exist." + dirLocation) else: print("Directory does not exists. Creating new one." + dirLocation) …
1
vote
1 answer

How to rename multiple .Json files within a subfolder using python and pandas

I am having difficulty trying to rename Json files within a ton of subfolders. What I want to do is to replace json files with a count variable. Since, each and every one of the .json files end with messages_1.json within its respective folder. Here…
1
vote
3 answers

OS Error in the listdir function of os module

I am learning the os module of python, where I wrote the following code to try out the functions of the module. Input: os.getcwd() Output: 'C:\\projects\\humming_bird' Input: os.listdir() Output: ['.ipynb_checkpoints', 'All_images', …
Samar Pratap Singh
  • 471
  • 1
  • 10
  • 29
1
vote
0 answers

Python program can't handle running exes

My program stops working after successfully running the two exes. here is the code: from tkinter import * import os root = Tk() root.geometry('350x150') root.title("hurler") photo = PhotoImage(file = "Logo_Image.png") root.iconphoto(False,…
Matthew
  • 27
  • 6
1
vote
2 answers

python can't be started from pycharm windows terminal without full path

I can start python from windows cmd just typing "python", but it doesn't work from pycharm terminal - it writes, that "python" is not internal or external command, executable program, or batch file. So, os.system('python file.py') or…
leschtsch
  • 17
  • 4
1
vote
1 answer

Python file closes after program execution finishes when using os.startfile()

I have a program that produces a csv file and right at the end I am using os.startfile(fileName) but then due to the program finishing execution the opening file just closes also, same happens if I add a sleep after also, file loads up then once the…
alipali737
  • 23
  • 3
1
vote
0 answers

How to tell when python webbrowser has finished playing video

So I using code like this to open a YouTube link with webbrowser in python: webbrowser.open("youtube.com/watch?v=" + videoLink) and I need to tell when the video finishes so I can then do: os.system("TASKKILL /F /IM chrome.exe") Does anyone know…