trying to call main function with execfile with two arguments

Discussion in 'Python' started by Eric_Dexter@msn.com, Nov 2, 2006.

  1. Guest

    I was trying to find out what my value for filename is but it will not
    print. The file I am calling csoundgrid2.main seems to work fine when
    I call it directly from spe with two values and I have used this file
    dialog to load other files the error I am getting is. thanks for any
    help in advance

    File "C:\Python24\Lib\site-packages\boa-constructor\test of
    snake\csoundgrid2.py", line 35, in loadFile
    infile = open(sys.argv[1], 'r') #The first argument passed in is the
    file name
    IndexError: list index out of range

    def sco_editor(self):
    "Pick a sco file and load it into a sco editor"
    dlg = wx.FileDialog(self,"load sco file", ".", "", "*.sco",
    wx.OPEN)
    try:
    if dlg.ShowModal() == wx.ID_OK:
    filename = dlg.GetPath()
    # Your code
    print filename
    csoundgrid2.main(filename, """;<sco_header>""")
    #("csoundgrid2.py", filename ,""";<sco_header>""",
    shell=True)
    #os.startfile('csoundgrid2.py', filename,
    """;<sco_header>""")
    finally:
    dlg.Destroy()

    https://sourceforge.net/project/showfiles.php?group_id=156455
    http://www.dexrow.com
     
    , Nov 2, 2006
    #1
    1. Advertising

  2. Guest

    To extend and revise my notes this is the dialog box that comes with
    boa constructor with very little change.


    wrote:
    > I was trying to find out what my value for filename is but it will not
    > print. The file I am calling csoundgrid2.main seems to work fine when
    > I call it directly from spe with two values and I have used this file
    > dialog to load other files the error I am getting is. thanks for any
    > help in advance
    >
    > File "C:\Python24\Lib\site-packages\boa-constructor\test of
    > snake\csoundgrid2.py", line 35, in loadFile
    > infile = open(sys.argv[1], 'r') #The first argument passed in is the
    > file name
    > IndexError: list index out of range
    >
    > def sco_editor(self):
    > "Pick a sco file and load it into a sco editor"
    > dlg = wx.FileDialog(self,"load sco file", ".", "", "*.sco",
    > wx.OPEN)
    > try:
    > if dlg.ShowModal() == wx.ID_OK:
    > filename = dlg.GetPath()
    > # Your code
    > print filename
    > csoundgrid2.main(filename, """;<sco_header>""")
    > #("csoundgrid2.py", filename ,""";<sco_header>""",
    > shell=True)
    > #os.startfile('csoundgrid2.py', filename,
    > """;<sco_header>""")
    > finally:
    > dlg.Destroy()
    >
    > https://sourceforge.net/project/showfiles.php?group_id=156455
    > http://www.dexrow.com
     
    , Nov 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Westerman

    execfile and function call

    Dave Westerman, Sep 24, 2007, in forum: Python
    Replies:
    2
    Views:
    243
    Gabriel Genellina
    Sep 25, 2007
  2. ravi
    Replies:
    28
    Views:
    982
    Richard Heathfield
    Sep 26, 2007
  3. grbgooglefan
    Replies:
    2
    Views:
    430
    Pascal Bourguignon
    Jan 30, 2008
  4. grbgooglefan
    Replies:
    4
    Views:
    447
    Kenny McCormack
    Jan 30, 2008
  5. grbgooglefan
    Replies:
    0
    Views:
    398
    grbgooglefan
    Jan 30, 2008
Loading...

Share This Page