Error in File(File, "Rt"):Invalid 'Description' Argument in Complete.Cases Program

Error in file(file, rt ) : invalid 'description' argument in complete.cases program

It's hard to tell without a completely reproducible example, but I suspect your problem is this line:

path<-paste(directory,"/",id,".csv",sep="")

id here is a vector, so path becomes a vector of character strings, and when you call read.csv you're passing it all the paths at once instead of just one. Try changing the above line to

path<-paste(directory,"/",id[i],".csv",sep="")

and see if that works.

TypeError: a bytes-like object is required, not 'str' when writing to a file in Python 3

You opened the file in binary mode:

with open(fname, 'rb') as f:

This means that all data read from the file is returned as bytes objects, not str. You cannot then use a string in a containment test:

if 'some-pattern' in tmp: continue

You'd have to use a bytes object to test against tmp instead:

if b'some-pattern' in tmp: continue

or open the file as a textfile instead by replacing the 'rb' mode with 'r'.



Related Topics



Leave a reply



Submit