using python3 (in a venv) I am looking for a way to save some files, each strictly defined as its own full pathname in a variable I would do something looking like this: but I get errors about : I’m still new to python, so can you help define why and how I can fix that (method, syntax ?) Answer
Tag: path
Add directory to PATH inside a Python script such that a third-party module can find a DLL with ctypes find_library
Let’s say a third-party module moduleXYZ.py (that I don’t want to fork/modify) does: In my code main.py I’m importing it with This DLL is in C:Program Filesgsgs9.56.1bin which is not in my global system path. Question: how to add this directory to the path (for the duration of the script run, not permanently for the system) from inside my script
How to migrate all packages, settings, user data etc. after updating to a newer Python version?
I’ve just installed Python 3.10 on Windows 10 and none of my scripts are working. For instance, when doing jupyter notebook I get I’ve been using Python 3.9 and all the scripts are still located in C:Program FilesPython39Scripts. However, there is nothing in C:Program FilesPython310Scripts (besides pip). As a first attempt to solve the problem, I uninstalled Python 3.10 leaving
Location for Python version on macOS (using universal-installer for 3.10.5)
My very first post here, as new comer to MacOS and Python. Recently installed python 3.10.5 via macOS 64-bit universal2 installer .pkg file downloaded from python.org > Downloads > mac OS on MacOS 12.4 [M1/Apple Silicon]. In terminal, the command python3 shows the version as 3.10.5. But echo $PATH is giving me a path leading to /Library/Frameworks/Python.framework/Versions/3.10/bin I was expecting
Accessing script file location from an external file python
I have the following bizarre set up. Consider 3 scripts in different directories: root1/folderA/scriptA.py root2/folderB/scriptB.py root2/folderC/scriptC.py The first file and it’s location are fully modifiable. The second and third are completely fixed. scriptA.py contains a parent class: scriptB.py contains a child class: scriptC.py contains the code to execute: In scriptC.py what I want is the behaviour to get the path
Find a Excel file in directory, compress and send it to another folder
I have an Excel file WK6 that is downloaded in the below folder: The Python script should first navigate till the above directory and then find the excel file WK6 (the name of the excel file changes as per week) and compress it. Then move it to some other directory. Please help me understand how can I find and compress
Import functions from another directory
I am running a python script (app.py) where I have to use two functions from another script (src.py), located inside another directory. The structure is the following: I am using, in app.py, the following lines: to access to the functions odd_all, even_all declared inside src.py. However, I get the error: ModuleNotFoundError: No module named ‘src’. How could I solve this
All possible combinations of a list of tuples
I’m creating “Boggle” in python, and I have a list of tuples that represent coordinates on a game board: I’m trying to create a new list of lists of tuples that will represent all possible paths on the board. It’d look something like this: I tried using itertools.combinations and itertools.permutations but it doesn’t seem to do the job, for example
Python pathlib.Path library always cuts last folder from the path and adds it to the name of created file
So here is the problem, I have some path which is like this: Then I use this to “make” it win path: So now every time I use it, to create some other files inside of path directory, my files are created inside of “category” folder with prefix UFF, so file names are: instead of For creation of files I
When import a python file into another (in a subdirectory) it stops finding the csv in the same directory
I’m trying to import the cleaning file in the managers file like this: The main folder contains the files cleaning, transaction listing and a sub folder called “apps” with the managers file: Also note that the cleaning file reads the transaction listing.csv file. The issue I’m getting when running is: And “Transaction Listings.csv” is correctly loaded by cleaning but no