karpathy / neuraltalk2

Efficient Image Captioning code in Torch, runs on GPU
5.49k stars 1.26k forks source link

read 0 blocks instead of 1 at /export/home/jkhurana/torch/pkg/torch/lib/TH/THDiskFile.c:563 #164

Closed jKhurana closed 7 years ago

jKhurana commented 7 years ago

I was trying to read a file with readSting() method. Below is my code

require 'torch'
require 'pl'

local f = torch.DiskFile('train')
f:clearError()
local rawdata = f:readString('*l')
while (not f:hasError()) do
    print(rawdata)
    rawdata = f:readString('*l')
end

First it reads all the lines of file and at last gives the following error read 0 blocks instead of 1 at /export/home/jkhurana/torch/pkg/torch/lib/TH/THDiskFile.c:563

I can not use io.read() as I have to serialise the content later.

jKhurana commented 7 years ago

Problem is solved. My file was not in quite() mode.