1,918 questions
7 votes
1 answer
152 views
Rename temporary file after closing its file descriptor in Python
I want to atomically write files in Python. pathlib and tempfile should be used. I have import os from pathlib import Path import tempfile def atomic_write(f: Path, data: bytes) -> None: with ...
0 votes
1 answer
73 views
Python tempfile TemporaryDirectory path changes multiple times after initialization
I am using tempfile with Polars for the first time and getting some surprising behavior when running it in a serverless Cloud Function-like environment. Here is my simple test code: try: with ...
1 vote
1 answer
78 views
Setting os.environ["TMP"] works in the code but not in pytest tests
I have the following python code: import tempfile import os def test_paul_confused(): os.environ["TMP"] = "/home/fedora" assert tempfile.gettempdir() == "/home/fedora&...
0 votes
0 answers
39 views
Python tempfile SpooledTemporaryFile write to a gzip without writing to disk where possible?
I am trying to create a snippet of Python code that first writes a possibly large text file (think csv) to a SpooledTemporaryFile in memory. Then that spooled file is compressed with gzip. While some ...
0 votes
1 answer
58 views
Python save TemporaryFile read as "w+b" to compressed tarfile
I am given a SpooledTemporaryFile through FastAPI's UploadFile. My goal is to write it to disk so I can extract it and process its contents later. This seems simple, but I am having problems saving ...
0 votes
1 answer
108 views
Undertow FileUtil cut of UTF-8 characters and concatenate the two half character as a character
If my multipart post is bigger than MultipartConfigElement.fileSizeThreshold, then my post is out of a temporary file. Undertow FileUtils read it so: public static String readFile(InputStream file, ...
2 votes
1 answer
83 views
How to write models to tempdir()
I'm creating an R package that automatically creates trained models. One of the goals is to allow the user to save the trained models for use with future data. The trained models were originally saved ...
0 votes
1 answer
75 views
Pytest Fixture Fails to Clean Up Directories for Specific Test Cases
I am using a Pytest fixture to clean up temporary files and directories created during tests. The fixture works for most test cases, but it fails to completely delete directories created in the first ...
2 votes
1 answer
78 views
Why am I getting "not a valid identifier" when trying to read a tmp file in a bash script?
I am using a bash script with some inline python to read a JSON API. I take a small part of the output and dump it into a temporary file. I know that the temporary file exists, because I am able to ...
0 votes
0 answers
20 views
error accessing downloaded mdb temp file in R using RODBC [duplicate]
I want to download an MS Access file (.mdb) file available online and handle its content from within R. I'm, however, having an issue opening it as the result of a temporary download. I have used the ...
5 votes
1 answer
121 views
Where should an application targeting Linux store temporary files that are expected to be larger than memory?
With Ubuntu 24.10 switching to a tmpfs-based (i.e. in-memory) /tmp, having a /tmp that is not usefully larger than memory, or even one that is smaller than memory, is about to become a lot more common....
-1 votes
2 answers
515 views
Volatile(Temp) Tables in BQ
I am trying to find a way to create Volatile/Temp tables in BQ as we can do in Teradata. I tried begin/end and it worked but cant access the temp table via select * just after running it as getting ...
-3 votes
1 answer
89 views
Why is tempfile.gettempdir() giving me the wrong path? [closed]
I have code that is trying to create a directory in my temp folder. My code is : temp = os.path.join(tempfile.gettempdir(), "HDD") print(temp) And it prints: C:\Users\JEFFSA~1\AppData\Local\...
1 vote
0 answers
215 views
Python temporary directory "access is denied" error for external subprocesses on Windows
I want to create a temporary folder on windows using tempfile.TemporaryDirectory, and use subprocess to execute an external program that will use that temporary directory. This does not seem to work ...
0 votes
1 answer
87 views
Error in file(fn, "rb") : cannot open the connection
I want to buffer some bioclimatic variables with the following code. I'm using R 4.4.1 on a windows 11 22H2 PC 64bit. # test buffersizes results <- lapply(buffersizes, function(buffer_distance) { ...