i'm trying run sqoop command inside python script. had no problem trough shell command, when i'm trying execute python stript:
#!/usr/bin/python sqoopcom="sqoop import --direct --connect abcd --username abc --p --query "queryname" " exec (sqoopcom)
i got error, invalid syntax, how solve ?
the build in exec
statement you're using interpreting python code inside python program.
what want execute external (shell) command. use call
subprocess module
import subprocess subprocess.call(["echo", "hello", "world"])
Comments
Post a Comment