Hello,Everybody,

Now I am using R (D)COM Server from Python to manipulate some data. When I 
try to use "read.table" function to read some data, an error occurred. 
However these statements work well when they are input to R directly. It is 
so odd.

The Python scripts are as the following,

from win32com.client import Dispatch
sc=Dispatch("StatConnectorSrv.StatConnector")
sc.Init("R")
sc.SetSymbol("dir","D:/wangwm/work/LeafAngle/Py")
sc.Evaluate("setwd(dir)")
sc.SetSymbol("file","FIFE7184.LAD")
#print(sc.Evaluate("file"))
sc.SetSymbol("sep",'","')
print(sc.GetSymbol("file"))
print(sc.Evaluate("getwd()"))
print(sc.Evaluate("read.table(file,sep=sep,skip=4)"))

The error disappear when commenting the last statement. So I am wondering 
whether someting wrong with the "read.table" function when calling it from 
Python. Did anybody here encounter this problem? The error imformation was 
as the following,

Running 'D:\wangwm\work\LeafAngle\Py\test.py' ...
FIFE7184.LAD
D:/wangwm/work/LeafAngle/Py
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\sm\scriptutils.py", line 49, in run
exec codeObject in mainDict
File "<source>", line 12, in ?
File "C:\Python24\lib\site-packages\win32com\gen_py\18C8B661-
81A2-11D3-9254-00E09812F727x0x1x1.py", line 51, in Evaluate
return self._ApplyTypes_(6, 1, (12, 0), ((8, 1),), 'Evaluate', 
None,bstrExpression
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 446, 
in _ApplyTypes_
return self._get_good_object_(
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, 
-2147221493), None)
Exception raised while running script <source>

Best Regards,
Weimin Wang

********************************
LSIIT, ULP, Strasbourg, France
********************************

P.S. 
The format of FIFE7184.LAD is as the following,

7184FIFE.LAD LEAF_ANGLE_DATA 20 \DOCUMENT\BIOLOGY\LEAF_ANG.DOC Dr. Yuangui 
Li
- -
- -
\DATA\BIOLOGY\LEAF_ANG\7160FIFE.LAD \DATA\BIOLOGY\LEAF_ANG\7201FIFE.LAD
SITEGRID_ID,STATION_ID,OBS_DATE,DISTRIBUTION_TYPE,LEAF_BIN_CENTER_ANG,LTER_SPECIES_CODE,SPECIES_NAME,PRCNT_LEAF_AREA,TOTAL_LEAF_AREA,FIFE_DATA_CRTFCN_CODE,LAST_REVISION_DATE
'FIFE-LAM',99,03-JUL-87,'ZENITH ',85.5,140,'INLAND IRONWEED ',.041,1635.97,'CPI 
',27-JAN-90
'FIFE-LAM',99,03-JUL-87,'ZENITH ',76.5,140,'INLAND IRONWEED ',.085,1635.97,'CPI 
',27-JAN-90

	[[alternative HTML version deleted]]


