I have this code where I am trying to prompt the user to input a path for a file and depending on the title of the file, it would rename it accordingly. This is what I have so far: I want to rename the file to Fact Sheet if Factssheet appears inside the previous title. However, I have 2 issues
Tag: path
Python f string with folders
I’m trying to use regex to find a specific file name in a folder, however it seems like my regex is not working. Inside my folder the names of the excel files are Answer You are not testing your regex against anything. pattern.fullmatch will return a method object. You probably wanted to write That being said, I don’t see a
Different python used in .cmd when file is ran vs. when python is opened directly
On Windows 10: Hi, I am having an issue with understanding how my computer works with python. When I run a python file in my IDE, Atom, it uses the python from PATH. When I run python in .cmd, it uses the python from PATH. When I execute the same python file from .cmd it uses a python that is
what could cause this error : FileNotFoundError: [Errno 2] No such file or directory
I’m very new to coding and Python so I’m really confused by this error. Here’s my code from an exercise where I need to find the most used word into a directory with multiples files: Here’s the error I get: What could cause this kind of error? Answer here’s what i guet what could cause this kind of error ?
python Pathlib, how do I remove leading directories to get relative paths?
Let’s say I have this directory structure. I want to isolate path components relative to root1/root2, i.e. strip out the leading root part, giving relative directories: The root depth can be arbitrary and the files, the node of this tree, can also reside at different levels. This code does it, but I am looking for Pathlib’s pythonic way to do
Issue with folder path in tkinter (python)
I am having an issue of finding the bug in my code in relation to the folder path using filedialog. I have the following code The following error shows up: Answer To use you have to first create global doesn’t create variable but it is only used in function to inform this function to use external/global variable when you use
Fixing PATH for Python libraries using Bash
I am attempting to install some Python libraries by executing variations of the following command in Bash: I installed Python3 using Homebrew. I then get variations of the following message each time: WARNING: The scripts f2py, f2py3 and f2py3.7 are installed in ‘/Users/x/Library/Python/3.7/bin’ which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress
The Python executable is not recognized on Windows 10
I recently installed Python 3.6.3 on my device. When I type python in my cmd window, it gives me this error. I do have the PATH in the environment variables. Path Lists. This should normally fix it, but python is still not recognized. Answer The path to the Python executable needs to be in the System PATH variable. Note this
Why would I add python to PATH
I am beginning to look at python, so when I found a tutorial it said that the first thing to do would be to download python from www.python.org/downloads/ Now when I downloaded python 3, I then started the installation and got to Why would I want to “Add Python 3.5 to PATH”? What is PATH? Why is it not ticked
Python imports relative path
I’ve got a project where I would like to use some python classes located in other directories. Example structure: The absolute path varies, because this project is run on different machines. When my python file with MySampleClass located in /mydir is executed, how do I import OtherClassRoot located in /dir or OtherClassA located in /subdirA? I tried things like: or