Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 从proc LUA读取访问冲突打开文件_File_Lua_Io_Sas - Fatal编程技术网

File 从proc LUA读取访问冲突打开文件

File 从proc LUA读取访问冲突打开文件,file,lua,io,sas,File,Lua,Io,Sas,我在SAS中编程,希望编写一个脚本,并使用LUA创建一个xml文件 首先,我启动proc LUA并传递文件名 ; --接下来,我打开文件进行写入,写入一些内容并关闭它 print('DEBUG: before opening') file = io.open (file_name, "w") print('DEBUG: after opening, before writing') file:write ("<test/>", "\n") pr

我在SAS中编程,希望编写一个脚本,并使用LUA创建一个xml文件

首先,我启动
proc LUA
并传递文件名 ;

--接下来,我打开文件进行写入,写入一些内容并关闭它

    print('DEBUG: before opening')
    file = io.open (file_name, "w")
    print('DEBUG: after opening, before writing')
    file:write ("<test/>", "\n")
    print('DEBUG: after writing, before closing')
    file:close()
    print('DEBUG: after closing')
/*这样做有效:文件是使用此内容创建的

<test/>
我不知道这是一个纯粹的LUA问题,还是与SAS中的
proc LUA
相关的问题


由于未打印最后一条调试消息,因此在关闭文件时似乎出现了问题。我尝试了几个不同的选项来执行
open
命令,并尝试删除
io.write
,但没有任何帮助。

您的代码对我来说运行良好(在
SYSVLONG=9.04.01M3P062415
SYSSCP=LIN X64

或许可以尝试以下稍微不同的方法

%let file = %sysfunc(pathname(work))/new.xml;

proc lua restart;
submit;
    local file_name = sas.symget("file")
    print (file_name)
    file = io.open (file_name, "w")
    io.output(file) -- sets default output
    io.write ("<test>", "\n")
    io.write ("write to file", "\n")
    io.write ("</test>", "\n")
    io.close(file)
endsubmit;
run;
%let文件=%sysfunc(路径名(工作))/new.xml;
程序lua重启;
提交
本地文件\u name=sas.symget(“文件”)
打印(文件名)
file=io.open(文件名“w”)
输出(文件)——设置默认输出
io.write(“,“\n”)
io.write(“写入文件”、“\n”)
io.write(“,“\n”)
io.close(文件)
结束提交;
跑

您使用的是哪个维护版本?(
&sysvlong
)。这看起来像是SAS支持的功能。
%put&sysvlong打印
9.04.01M3P062415
我想它一定是与windows相关的-肯定是一个支持跟踪,因为它在完全相同的维护版本上对我有效。我假设您启用了
XCMD
,并且系统未处于锁定状态?我在具有9.4M4 64位的windows上收到相同的回溯错误。SYSVLONG=9.04.01M4P110916请让我们了解sas支持部门的说明。
<test/>
NOTE: Lua initialized.
\\ourCompany\ourTeam\ourProject\myFile.xml
DEBUG: before opening
DEBUG: after opening, before writing
DEBUG: after writing, before closing

ERROR:  An exception has been encountered.
Please contact technical support and provide them with the following traceback information:

The SAS task name is [LUA (2)]
ERROR:  Read Access Violation LUA (2)
Exception occurred at (89400CB7)
Task Traceback
Address   Frame     (DBGHELP API Version 4.0 rev 5)
00007FFD89400CB7  000000000862F1F0  ntdll:RtlAllocateHeap+0x27
00000000084D2ACD  000000000862F1F8  sasplua:tkvercn1+0x81A8D
00000000084D0E7F  000000000862F250  sasplua:tkvercn1+0x7FE3F
00000000084D0D17  000000000862F280  sasplua:tkvercn1+0x7FCD7
00000000084CF711  000000000862F2B0  sasplua:tkvercn1+0x7E6D1
0000000008462609  000000000862F300  sasplua:tkvercn1+0x115C9
0000000008474A7D  000000000862F410  sasplua:tkvercn1+0x23A3D
0000000008485C7E  000000000862F530  sasplua:tkvercn1+0x34C3E
0000000008474349  000000000862F570  sasplua:tkvercn1+0x23309
00000000084788A4  000000000862F8D0  sasplua:tkvercn1+0x27864
0000000008478A9D  000000000862F940  sasplua:tkvercn1+0x27A5D
0000000008469746  000000000862F9A0  sasplua:tkvercn1+0x18706
00000000084523A2  000000000862F9F0  sasplua:tkvercn1+0x1362
000000000845224E  000000000862FB10  sasplua:tkvercn1+0x120E
00000000084529F4  000000000862FBF0  sasplua:tkvercn1+0x19B4
0000000001A489DB  000000000862FBF8  sashost:Main+0x10EBB
0000000001A4E61D  000000000862FF50  sashost:Main+0x16AFD
00007FFD875613F2  000000000862FF58  KERNEL32:BaseThreadInitThunk+0x22
00007FFD893E54F4  000000000862FFD0  ntdll:RtlUserThreadStart+0x34

NOTE: The SAS System stopped processing this step because of errors.
%let file = %sysfunc(pathname(work))/new.xml;

proc lua restart;
submit;
    local file_name = sas.symget("file")
    print (file_name)
    file = io.open (file_name, "w")
    io.output(file) -- sets default output
    io.write ("<test>", "\n")
    io.write ("write to file", "\n")
    io.write ("</test>", "\n")
    io.close(file)
endsubmit;
run;