#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    9
    Rep Power
    0

    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+
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,840
    Rep Power
    480

    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!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    9
    Rep Power
    0
    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.

IMN logo majestic logo threadwatch logo seochat tools logo