0

hello ive been working on a small project and im a bit stuck.

import subprocess

path = "/var/log"

#i wanna be able to do something like 
subprocess.call("nano path")
# but i noticed that using nano like that wont work because path is just a python string
any help
3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by Gribouillis
0

thanks im gonna test it out as soon as i get home and give an update

Edited by glenwill101

0

unfortunately i did not get our solution to work i kept getting an error "file or directory not found" however after a little digging Here i realized that to get subprocess() to execute "nano path" i would have to supply arguments as alist eg.

import subprocess

path = "somefile.txt"

subprocess.call([nano, path])

Edited by glenwill101

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.