ibm bluemix - Spark set_hadoop_config error -


does know causing error? looks basic.

in:

def set_hadoop_config(credentials): prefix = "fs.swift.service." + credentials['name'] hconf = sc._jsc.hadoopconfiguration() hconf.set(prefix + ".auth.url", credentials['auth_url']+'/v2.0/tokens') hconf.set(prefix + ".auth.endpoint.prefix", "endpoints") hconf.set(prefix + ".tenant", credentials['project_id']) hconf.set(prefix + ".username", credentials['user_id']) hconf.set(prefix + ".password", credentials['password']) hconf.setint(prefix + ".http.port", 8080) hconf.set(prefix + ".region", credentials['region']) 

out:

name: compile error message: :1: error: ':' expected ')' found. def set_hadoop_config(credentials): ^ stacktrace:

thanks!

there 2 issues code.

  1. it python code snippet, executed within scala kernel, demands valid scala code. can switch kernels using kernel->change kernel menu option. reason compileerror seeing.

  2. if executed python kernel, receive indentationerror, because function body not indented correctly. use instead:

     def set_hadoop_config(credentials):       prefix = "fs.swift.service." + credentials['name']       hconf = sc._jsc.hadoopconfiguration()       hconf.set(prefix + ".auth.url", credentials['auth_url']+'/v2.0/tokens')       hconf.set(prefix + ".auth.endpoint.prefix", "endpoints")       hconf.set(prefix + ".tenant", credentials['project_id'])       hconf.set(prefix + ".username", credentials['user_id'])       hconf.set(prefix + ".password", credentials['password'])       hconf.setint(prefix + ".http.port", 8080)       hconf.set(prefix + ".region", credentials['region']) 

(tip: in notebook, select complete function body , hit tab once indent it)


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -