假设我有
osm2pgsql_proc = sp.Popen(
[osm2pgsql, "--create", "--database", db_name,
"--cache", str(cache_size), "--number-processes",
str(osm2pgsql_number_processes), "--slim", "--port", str(db_port),
"--host", db_host, "--username", db_user, "--latlong", "--password",
"--keep-coastlines", "--extra-attributes", "--hstore-all"]+osm_files,
stdin=sp.PIPE)
# tried all of the following alternatives
#osm2pgsql_proc.stdin.write(db_password+"\x1a")
#osm2pgsql_proc.stdin.flush()
#osm2pgsql_proc.stdin.write(db_password+"\n")
#osm2pgsql_proc.stdin.flush()
#osm2pgsql_proc.communicate(db_password+"\x1a")
#osm2pgsql_proc.communicate(db_password+"\n")
#osm2pgsql_proc.stdin.flush()
osm2pgsql_proc.wait()
如何通过Password:
提示?在
请注意:我知道pexpect
,我可以想象可能有类似的模块,但我正在寻找一种解决方案,它可以更好地理解python和OS、Linux的子进程和相关概念,除非有人能提供一个合理的答案来解释它没有按照我所理解的方式工作。在
目前没有回答
相关问题 更多 >
编程相关推荐