Results 1 to 5 of 5

Thread: How do I run an sh script from a button

  1. #1
    Join Date
    Jul 2012
    Beans
    12

    How do I run an sh script from a button

    I'm currently developing an installer for a certain game. Right now I have an sh script and I'm not sure how to activate it. I am building the GUI in glade if that helps (python)

  2. #2
    Join Date
    Jan 2009
    Location
    South Carolina
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How do I run an sh script from a button

    Edit:
    Sorry, misread your post.

    Perhaps have a look at this:
    http://stackoverflow.com/questions/8...mand-in-python
    Last edited by ubudog; July 1st, 2012 at 01:57 AM.

  3. #3
    Join Date
    Jul 2012
    Beans
    12

    Re: How do I run an sh script from a button

    inserted code as

    self.beginbutton = self.builder.get_object("beginbutton")

    def on_beginbutton_clicked(self, widget):
    subprocess.call(['home/mcinstaller/data/media/Minecraft_Installer_.sh'])

    Getting this error when typing 'quickly run' into the terminal


    (mcinstaller:16747): Gtk-WARNING **: Theme parsing error: gnome-panel.css:28:11: Not using units is deprecated. Assuming 'px'.
    /usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py:391: Warning: g_object_set_property: construct property "type" for object `Window' can't be set after construction
    Gtk.Window.__init__(self, type=type, **kwds)
    /usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py:391: Warning: g_object_set_property: construct property "type" for object `McinstallerWindow' can't be set after construction
    Gtk.Window.__init__(self, type=type, **kwds)

    I am new to coding so any help is appreciated

  4. #4
    Join Date
    Jan 2009
    Location
    South Carolina
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How do I run an sh script from a button

    I am not too good with Python, but perhaps change:
    Code:
    subprocess.call(['home/mcinstaller/data/media/Minecraft_Installer_.sh'])
    to

    Code:
    subprocess.call(['sh /home/mcinstaller/data/media/Minecraft_Installer_.sh'])
    Best,
    ubudog

  5. #5
    Join Date
    Nov 2010
    Location
    UIUC
    Beans
    70
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: How do I run an sh script from a button

    The error had nothing to do with the subprocess call. He constructs the Window, and then tries to change one of its attributes, which is not allowed. Put another way, you can only set the attribute Window.type as part of the function call to construct the Window. The problem is with code not posted here.
    Intel Core i7-2600K (3.80 GHz) (Hyper 212+ Air Cooler)
    MSI Twin Frozr II GTX 460 (768 MB)
    Seagate 7200 RPM 1 TB && Hitachi 5400 RPM 2 TB
    Ubuntu 11.04 Classic Desktop / Windows 7 Professional (games only)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •