file-handling Questions
1
While I understand os.access() can be used to check if an existing file can be read or written, I was wondering whether a similar method can be used to see whether a file can be created.
I need to...
Surpass asked 19/7, 2019 at 14:25
8
Solved
My code is for a script that looks at a folder and deletes images that are under a resolution of 1920x1080. The problem I am having is that when my code runs;
import os
from PIL import Image
whil...
Desta asked 30/11, 2014 at 16:32
3
Solved
I can't find a way of reading the Minecraft world files in a way that i could use in python
I've looked around the internet but can find no tutorials and only a few libraries that claim that they c...
Marvel asked 7/8, 2019 at 15:36
7
Solved
I am using Eclipse and jdk1.7. I am making a basic program using file handling, in which an output directory inside the directory is to be made. But when I run the program, the output is showing fa...
Chiseler asked 19/7, 2013 at 14:2
12
Solved
I have a file called diff.txt. I Want to check whether it is empty.
I wrote a bash script something like below, but I couldn't get it work.
if [ -s diff.txt ]
then
touch empty.txt
rm full.txt
els...
Punjab asked 1/4, 2012 at 13:41
6
Solved
I have a file with some of user1's data. I want to use the same file for user2 by clearing the content of the file.
My idea is that when a new user comes, data of the previous user should be clear...
Pliske asked 27/1, 2011 at 10:36
8
Solved
I have a URL to an image which i want to save locally, so that I can use Paperclip to produce a thumbnail for my application. What's the best way to download and save the image? (I looked into ruby...
Cutworm asked 25/3, 2010 at 13:36
11
Solved
How can I do the equivalent of mv in Python?
mv "path/to/current/file.foo" "path/to/new/destination/for/file.foo"
Kevin asked 13/1, 2012 at 22:17
4
I try to create files and write the contents dynamically. Below is my code.
$sites = realpath(dirname(__FILE__)).'/';
$newfile = $sites.$filnme_epub.".js";
if (file_exists($newfile)) {
$fh = fop...
Ledezma asked 14/12, 2013 at 5:30
1
Solved
I was trying to read the JSON file from my r studio as a purpose of learning how to read JSON file, but suddenly i got an parsing error.
employee.json
{
"id" : ["1","2&q...
Heterocyclic asked 31/1, 2022 at 2:19
10
Solved
I am trying to create a text file using VB.Net with UTF8 encoding, without BOM. Can anybody help me, how to do this?
I can write file with UTF8 encoding but, how to remove Byte Order Mark from it?...
Dionysian asked 13/3, 2010 at 7:43
2
Solved
I have a scipy.sparse.csr matrix and would like to dump it to a CSV file. Is there a way to preserve the sparsity of the matrix and write it to a CSV?
Gradualism asked 22/5, 2011 at 11:11
1
I am running code which after sometimes hours, sometimes minutes fails with the error
OSError: [Errno 24] Too many open files
And I have real trouble debugging this. The error itself is always tri...
Coruscate asked 14/8, 2021 at 14:9
9
Solved
I'm in a tutorial which introduces files (how to read from file and write to file)
First of all, this is not a homework, this is just general help I'm seeking.
I know how to read one word at a time...
Gonick asked 23/10, 2012 at 17:5
3
I am in the process of trying to make a decision on how, when and where to handle uploaded files from users. We are in a MicroService environment (PHP + Linux) for a new system to be deployed in th...
Brasilein asked 12/12, 2017 at 22:1
5
I am using the following code to read a file in Go:
spoon , err := ioutil.ReadFile(os.Args[1])
if err!=nil {
panic ("File reading error")
}
Now I check for every byte I pick for what character ...
Inflexed asked 22/1, 2013 at 22:49
1
I've got an HTML form that has a PHP pgm to write the results to a file. I've basically copied it from The Web. It's not rocket surgery. It's running with PHP 7 on a Raspberry Pi with the most rece...
Zinn asked 30/3, 2020 at 0:29
2
Solved
I was looking at the SO post C++ file stream open modes ambiguity. I wanted to know the default file opening mode of fstream. One of the answer says,
What the above implies is that the following...
Regen asked 26/10, 2017 at 7:51
2
Solved
The code I'm working on throws the error Unsupported operand type(s) for +: 'WindowsPath' and 'str'. I have tried many things, and none have fixed this (aside from removing the line with the error,...
Splenomegaly asked 23/1, 2020 at 1:53
1
We have a problem in production with a Windows application written in a mix of C and C++ where MoveFileEx occationally reports "The process cannot access the file because it is being used by anothe...
Regicide asked 28/12, 2018 at 11:8
3
Solved
I'm trying to make billing system for my father's restaurant just for practice. The problem is that the program doesn't read the complete string one time.e.g If there were "Chicken burger"...
Arak asked 3/1, 2014 at 11:47
3
Solved
try:
data=open('info.txt')
for each_line in data:
try:
(role,line_spoken)=each_line.split(':',1)
print(role,end='')
print(' said: ',end='')
print(line_spoken,end='')
except ValueError:
pri...
Zoster asked 21/12, 2015 at 15:30
2
Solved
I am trying to work on Lua file handling. I am able to open (read), write and close the file via:
local session_debug = io.open("/root/session_debug.txt", "a")
session_debug:wri...
Arrowood asked 23/10, 2015 at 7:21
3
What is the best way to create/write/update a file in remote HDFS from local python script?
I am able to list files and directories but writing seems to be a problem.
I have searched hdfs and sn...
Cornwall asked 21/12, 2017 at 14:11
2
I have a .dat file which I don't have any idea about how it was created and what delimiter was used and any details about it. I just have its corresponding mdf and csv file. Thats all.
Is there any...
Adrianneadriano asked 17/1, 2020 at 7:6
1 Next >
© 2022 - 2025 — McMap. All rights reserved.