I have a problem in python. I'm using scipy, where i use scipy.io to load a .mat file. The .mat file was created using MATLAB.
listOfFiles = os.listdir(loadpathTrain)
for f in listOfFiles:
fullPath = loadpathTrain + '/' + f
mat_contents = sio.loadmat(fullPath)
print fullPath
Here's the error:
Tra...
Is it possible to move files from a network location that requires credentials to another network location that also requires credentials without mapping any drive. (ie: Without any use of P/Invoke)
Example:
FileInfo fi = new FileInfo(@"\\SomeComputer\SomeDrive\SomeFolder\someFile.txt");
fi.MoveTo(@"\\AnotherComputer\AnotherDrive\Anoth...
I have a some 350-lined CSV File with all sorts of vendors that fall into Clothes, Tools, Entertainment, etc.. categories. Using the following code I have been able to print out my CSV File.
<?php
$fp = fopen('promo_catalog_expanded.csv', 'r');
echo '<tr><td>';
echo implode('</td><td>', fgetcsv($fp, 4096, ','));
echo ...
So here is my code
if (!File.Exists(pathName))
{
File.Create(pathName);
}
StreamWriter outputFile = new StreamWriter(pathName,true);
But whenever I run the program the first time the path with file gets created. However once I get to the StreamWriter line my program crashes because it says my fie is in use by another process. Is t...
Possible Duplicate:
C#: Is there a way to check if a file is in use?
I'm using the System.IO.File class to delete a file, but of course this causes an exception if it's being used. I don't just want to catch the exception and forget about it (that would be using an exception as a flow construct); I'd like to know how to check ...
We have a daily job that processes files delivered from an external source. The process usually runs fine without any issues but every once in a while we have an issue of attempting to process a file that is not completely transferred.
The external source SCPs these files from a UNIX server to our Windows server. From there we try to pr...
I have a little bash function to log my Macports outputs to a file (since installs often spew little tidbits that are easy to lose in terminal noise), then I just cat the file to the terminal:
function porti {
command sudo port install $@ >> $1.log 2>&1; cat $1.log
}
Is there a way to do this concurrently?
BTW I pass $@ to instal...
I am reading one line at a time from a file, but at the end of each line it adds a '\n'.
Example:
The file has: 094 234 hii
but my input is: 094 234 hii\n
I want to read line by line but I don't need to keep the newlines...
My goal is to read a list from every line: I need ['094','234','hii'], not ['094','234','hii\n'].
Any advice...
I have a bunch of HTML files in HTML folder. Those HTML files have unicode characters which I solved by using filter(lambda x: x in string.printable, line). Now how do I write the changes back to the original file? What is the best way of doing it? Each HTML file is of 30 kb in size.
1 import os, string
2
3 for file in os.listdir...
I want to replace a binary file if the contents are different.
So I need to be able to compare the binary file (without having to deserialize it).
Is this possible?
I used binary formatter to save the file.
...
I'm receiving some data from a ZODB (Zope Object Database). I receive a mybrains object. Then I do:
o = mybrains.getObject()
and I receive a "Person" object in my project. Then, I can do
b = o.name
and doing print b on my class I get:
José Carlos
and print b.name.__class__
<type 'unicode'>
I have a lot of "Person" objects. T...
Hello guYz plz help me out in making it possible to open the files by the adress provided in an array of strings.........
a way to open file is as given below...
ifstream infile;
infile.open("d:\aslam.txt");
but how can i open file providing an array of string as an adress of file.....
like this
infile.open(arr[i]); (but its not worki...
In Java how can I take the data of my file on my display screen?
I want to use data in my file and also want that data to be displayed on my output screen when I execute my program. Can any body please help by providing me such example in Java language. Thank you!
...
Hi,
I am trying to find answer for the following ,for the past couple of days ,but couldnt find comprehensive answer
Problem Statement
I have a custom JSP tag class which handles a web form submission ,captures data and write it to same file in the filesystem.
As all web applications,this can be triggeredsimultaneosly ,and i fear that ...
I would like to write a Ada.Real_Time.Time in a file,
How can I do that?
Thanks
...
A simple question but I can't find the answer in my book. I want to read a binary file to seed a random number generator, but I don't want to seed my generator with the same seed each time I call the function, so I will need to keep a variable for my position in the file (not a problem) and I would need to know how to read a file startin...
Hello, when I have the fallowing code to read a binary file:
NSString* file = [NSString stringWithUTF8String:fileName];
NSString* filePath = resource ? [[NSBundle mainBundle] pathForResource:file ofType:nil] : [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathCompon...
Hello,
I am running some tests and need to write to a file. When I run the test's the open = (file, 'r+') does not write to the file. The test script is below:
class GetDetailsIP(TestGet):
def runTest(self):
self.category = ['PTZ']
try:
# This run's and return's a value
result = self.clien...
enum ID // IDs
{
ID_HEADER = 0, // ID 0 = headers
#include "DATA.CSV"
ID_LIMIT
};
I inherited some code here.....
Looking at "DATA.CSV" I see all the ID's used to populate the enum in column B, along with other data.
My question:
How does the enum know that it is u...
i have a piece of code here that breaks if the directory doesn't exist
System.IO.File.WriteAllText(filePath, content);
is it possible to do in one line (or a few lines) to check the directory leading to the new file doesn't exist and if not, to create it before creating the new file.
i'm in .NET 3.5 here.
...