December 5th, 2012, 09:29 AM
-
Python shortcut for multiple files
Hi
I try to create a shortcut in Python which opens multiple files at once.
My current script opens the file I need, but it opens also an empty file and returns an error:
Code:
import subprocess
path01 = "/usr/bin/gedit"
file01 = "test.txt"
subprocess.Popen([path01,file01])
#returns error:
# (gedit:6555): GLib-GIO-CRITICAL **: g_dbus_connection_get_capabilities:
# assertion `G_IS_DBUS_CONNECTION (connection)' failed
How to fix it, plz?
Conditions:
- Ubuntu 11.10 / 64bit
- Python 2.7.2+
December 5th, 2012, 11:07 AM
-
Cannot replicate failure.
My conditions are same as yours, and the program works (of course I get this Gdk-CRITICAL message for all my gtk programs:
(gedit:27544): Gdk-CRITICAL **: gdk_error_trap_pop_internal: assertion `trap != NULL' failed
Not obvious that it has any impact.)
You might try
$ sudo apt-get update
and does gedit work from the command line?
And why do you choose gedit when emacs is available?
[code]
Code tags[/code] are essential for python code and Makefiles!
December 5th, 2012, 11:28 AM
-
Originally Posted by b49P23TIvg
does gedit work from the command line?
I am not running it on my terminal - just on separate files.
My python file 'foo.py' contains the code above. It opens gedit with my 'test.txt' file + one more empty unnecessary no name file.
While running on Eric IDE it also asks to 'select the fork branch to follow'.
Originally Posted by b49P23TIvg
And why do you choose gedit when emacs is available?
I need just the simplest, fastest, easiest, basic txt file editor - because I don't need any advanced actions on my text files. I want just to open multiple files on multiple apps from single shortcut.