Scala工作表不评估REPL并在右侧打印结果

时间:2018-10-19 17:46:09

标签: eclipse scala scala-ide

我正在学习spark,并使用Eclipse ScalaIDE,在其中创建新的工作表。

当我们保存文件时会评估scala中的工作表,并且结果将打印在右侧,但是当我在工作表中进行一些更改时,不会发生这种情况。

这是我的scala工作表:

# pull all security groups from all vpcs in the given profile and region and save as a set
all_sgs = {sg['GroupId'] for sg in client.describe_security_groups()['SecurityGroups']}

# create a new set for all of the security groups that are currently in use
in_use = set()

# cycle through the ENIs and add all found security groups to the in_use set
for eni in client.describe_network_interfaces()['NetworkInterfaces']:
    for group in eni['Groups']:
        in_use.add(group['GroupId'])

unused_security_groups = all_sgs - in_use

for security_group in unused_security_groups:
    try:
        response = client.delete_security_group(GroupId=security_group)
    except ClientError as e:
        if e.response['Error']['Code'] == 'DependencyViolation':
            print('EC2/Security Group Dependencies Exist')
    else:
        print('Unexpected error: {}'.format(e))

有什么我想念的吗?

2 个答案:

答案 0 :(得分:0)

如果仅编写此内容,它将正确编写:

val hello: String = "Hello World!"
println(hello)

否则,您需要在定义对象后使用对象

答案 1 :(得分:0)

将scala安装更改为默认版本可以为我解决问题。

请按照以下步骤操作:

  1. 右键单击项目->属性-> Scala编译器
  2. 单击下拉菜单以反对Scala安装。
  3. 将下拉菜单中的值更改为“最新的2.12捆绑包(动态)”

enter image description here