Hi,
I need to open terminal in button action and also i need to run a terminal command. How can i make this done.
Thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Hi,
See this sample which executes the given command in the terminal,
import subprocess
subprocess.call(["mkdir", "docker_src"], cwd=o.build_dir)
Read more at: https://stackoverflow.com/questions/41781506/python-run-terminal-and-execute-command-in-it
If you want to open the terminal and execute the command, see this answer here: https://stackoverflow.com/questions/7574841/open-a-terminal-from-python
os.system("gnome-terminal -e 'bash -c \"sudo apt-get update; exec bash\"'")
Thanks
Hi,
If you need to open a terminal from Ubuntu use the code below.Consider action_open_terminal as the button function.
import os
def action_open_terminal(self):
os.system("gnome-terminal")
for running a command along with the above use
os.system("gnome-terminal -- 'bash -c \"sudo apt-get update; exec bash\"'")
above code is for system update, you can use your command instead of that
Regards
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
1
ก.ค. 19
|
19861 | ||
|
1
มิ.ย. 25
|
5667 | ||
|
2
ธ.ค. 24
|
8177 | ||
|
0
ก.พ. 23
|
4216 | ||
|
0
ต.ค. 20
|
2747 |
Thanks @Niyas Raphy @Cybrosys Techno Solutions Pvt.Ltd
i will try your suggestions