Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > trying to call main function with execfile with two arguments

Reply
Thread Tools

trying to call main function with execfile with two arguments

 
 
Eric_Dexter@msn.com
Guest
Posts: n/a
 
      11-02-2006
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/show...roup_id=156455
http://www.dexrow.com

 
Reply With Quote
 
 
 
 
Eric_Dexter@msn.com
Guest
Posts: n/a
 
      11-02-2006
To extend and revise my notes this is the dialog box that comes with
boa constructor with very little change.


http://www.velocityreviews.com/forums/(E-Mail Removed) 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/show...roup_id=156455
> http://www.dexrow.com


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call function whose function call with arguments is in astring Options grbgooglefan C Programming 4 01-30-2008 05:12 PM
How to call function whose function call with arguments is in astring grbgooglefan C++ 2 01-30-2008 07:18 AM
how #define a main() function and call our own main function? ravi C Programming 28 09-26-2007 01:33 AM
execfile and function call Dave Westerman Python 2 09-25-2007 01:43 AM



Advertisments