简体   繁体   中英

How to run command from within eclipse(Pydev)

Is it possible to run python command from within eclipse(Pydev)?

I want to create a procedure which will create database. Currently I create database by writing the command in command prompt, But I want the same from my code within eclipse.

Something like:

def createDatabase()
     createdb -U myUser -T template0 

Try popen2 module. It allows you to spawn processes. Then you can call your function from PyDev console

You can also execute a program from Run>External Tools>External Tools Configurations. Once you set it up, you can re-run it from the toolbar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM