File IO Failed

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

dhityayl
Posts: 14
Joined: Sun Aug 26, 2018 10:29 pm

File IO Failed

Postby dhityayl » Fri Oct 05, 2018 3:55 am

Hi,
I have a code for loop programming below. So basically i loop a rolling regression and after that i want to save to excel.
The code below works for the looping itself (without wfsave), but in the middle of the looping with wfsave, the loop failed. The error message is : File IO failed for file 'Could not create entry in zip file.' in "WFSAVE(TYPE=EXCELXML) "C:\USERS\DHITYA\DESKTOP\2\2001.T.CSV.XLSX" @KEEP DATE RETURN G1".
Is there something wrong with the code? It works before with just 2 files, but when i do 50 files, it failed.
If i want to try running the program again with different data, i should create a new destination folder to save my file, but it will failed again in the middle of the loop.
Thankyou

Code: Select all

cd "D:\Thesis_Loop\2002_2\dataset" %filenames = @wdir("D:\Thesis_Loop\2002_2\dataset") for !k=1 to @wcount(%filenames) %file = @word(%filenames, !k) wfopen %file import D:\Thesis_Loop\2002_2\dataset\index\Indeks_2002.csv import D:\Thesis_Loop\2002_2\dataset\index\FF3_2002.csv genr return=(((close-close(-1))/close(-1))*100)-rf !window = 60 !step = 1 !length = @obsrange equation eq1 !nrolls = @round((!length-!window+1)/!step) matrix(5,!nrolls) coefmat!k !j=0 for !i = 1 to !length-!window+1-!step step !step !j=!j+1 smpl @first+!i-1 @first+!i+!window-2 equation eq1.ls return c indeks mkt_rf smb hml colplace(coefmat!k, eq1.@coefs,!j) matrix(!nrolls,5) r1 matrix r1=@transpose (coefmat!k) series rbc series rbindeks series rbmkt series rbsmb series rbhml group g1 rbc rbindeks rbmkt rbsmb rbhml sample s1 @first+59 @last mtos(r1, g1, s1) if @isobject("s1") then delete s1 endif %path = "C:\Users\Dhitya\Desktop\2\" + %file + ".xlsx" wfsave(type=excelxml) %path @keep date return g1 'close @all next next

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: File IO Failed

Postby EViews Jason » Fri Oct 05, 2018 8:57 am

Is it failing on the same file every time (i.e. does the error message always refer to C:\USERS\DHITYA\DESKTOP\2\2001.T.CSV.XLSX)?

Can you post the list of filenames in the C:\USERS\DHITYA\DESKTOP\2 directory?

dhityayl
Posts: 14
Joined: Sun Aug 26, 2018 10:29 pm

Re: File IO Failed

Postby dhityayl » Fri Oct 05, 2018 3:27 pm

Hi. It works fine on other computer. I think the problem is not on the eviews program.
Thank you

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: File IO Failed

Postby EViews Jason » Wed Oct 10, 2018 7:21 am

I would then verify all the paths and files that are being referred to in your program exist. For example, make sure C:\USERS\DHITYA\DESKTOP\2\ and D:\Thesis_Loop\2002_2\dataset\index\ exist.

ashyam
Posts: 1
Joined: Tue Jan 19, 2021 10:16 am

Re: File IO Failed

Postby ashyam » Tue Jan 19, 2021 10:31 am

Hello,
I have the same issue as stated above.
The paths and files referred to in my program do exist and are correct.
I've written the code here, its a basic code to export the cl1 series to a new excel file titled TEST1 -

include k:\hugob\eviews\program\startup.prg
pageselect monthly
smpl @all
%smpl_test="2000M1 2020M12"
smpl {​​​​​​​%smpl_test}​​​​​​​
fetch(d=hugo) cl1
wfsave(type=excelxml) K:\Ashwin.Shyam\TEST\TEST1.xlsx @keep cl1 @smpl {​​​​​​​%smpl_test}​​​​​​​

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: File IO Failed

Postby EViews Gareth » Tue Jan 19, 2021 10:39 am

Change the folder location to something on C and see if that fixes it.

JC198998
Posts: 13
Joined: Thu Jan 02, 2025 7:13 pm

Re: File IO Failed

Postby JC198998 » Fri Apr 11, 2025 1:00 am

Hello,

I'm having the same issue. Is there a way to verify or fix the issue?


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests