我正在尝试以下代码:
sas = saspy.SASsession(cfgname='ssh', resutls='html',cfgfile='/Users/saumya.rb/opt/anaconda3/lib/python3.7/site-packages/saspy/sascfg.py')
错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/saumya.rb/opt/anaconda3/lib/python3.7/site-packages/saspy/sasbase.py", line 415, in __init__
self.sascfg = SASconfig(**kwargs)
File "/Users/saumya.rb/opt/anaconda3/lib/python3.7/site-packages/saspy/sasbase.py", line 130, in __init__
SAScfg = self._find_config(cfg_override=kwargs.get('cfgfile'))
File "/Users/saumya.rb/opt/anaconda3/lib/python3.7/site-packages/saspy/sasbase.py", line 267, in _find_config
SAScfg = importlib.import_module(tempname)
File "/Users/saumya.rb/opt/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 860, in get_code
File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/var/folders/pr/w_hplw1j7bl0vj2yj97_dd5mv3j_2t/T/tmp1bi7td8v/sascfg005.py", line 88
'ssh' : '/usr/bin/ssh',
^
SyntaxError: invalid syntax
请与我分享详细信息,例如我应该使用哪个python版本。我的sascfg.py应该是什么样子
我正在使用Python 3.7.4(默认,2019年8月13日,15:17:50)[Clang 4.0.1(tags / RELEASE_401 / final)] ::达尔文市的Anaconda,Inc.
using below config :
default = {'saspath' : '/sashome/compute/SASFoundation/9.4/sas'
'ssh' : '/usr/bin/ssh',
'options' : ["-fullstimer", "-autoexec", "/SAS9.4/SASConfig_bkp/compute/Lev1/SASApp/StoredProcessServer/autoexec.sas"],
'autoexec' : "libname mylib '/ngs/app/sasp';",
'host' : 'remote.linux.host',
'options' : ["-fullstimer"]
}
#ssh = {'saspath' : '/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_en',
# 'ssh' : '/usr/bin/ssh',
# 'host' : 'remote.linux.host',
# 'encoding': 'latin1',
# 'options' : ["-fullstimer"]
# }
#
ssh = {'saspath' : '/sashome/compute/SASFoundation/9.4/sas'
'ssh' : '/usr/bin/ssh',
'options' : ["-fullstimer", "-autoexec", "/ngs/app/sasp/SAS9.4/SASConfig_bkp/compute/Lev1/SASApp/StoredProcessServer/autoexec.sas"],
'autoexec' : "libname mylib '/ngs/app/sasp';",
'host' : 'remote.linux.host',
'options' : ["-fullstimer"]
}
您得到的错误是因为您在字典条目之间缺少逗号:
ssh = {'saspath':'/sashome/compute/SASFoundation/9.4/sas''ssh':'/ usr / bin / ssh',
路径说明后需要逗号。
对于autoexec,选项中列出的选项用于加载和运行远程SAS会话,而saspy autoexec是在会话建立并连接后saspy将为您提交的内容。因此,这是两个略有不同的事物。
添加逗号并摆脱此语法错误,然后看您得到什么。
谢谢,汤姆