473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

trying to call main function with execfile with two arguments

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

Nov 2 '06 #1
1 2321
To extend and revise my notes this is the dialog box that comes with
boa constructor with very little change.
Er*********@msn.com 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
Nov 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christopher Baus | last post by:
Hi, I'm new to Python and am learning the languge for writing test scripts for C++. I just finished reading this: http://www.artima.com/weblogs/viewpost.jsp?thread=4829 article. Coming...
2
by: Alberto Vera | last post by:
Hello: Could you tell me How I Can call a python program from another one? Regards
5
by: Darren Dale | last post by:
Hi, I have a variable saved in a file like this #contents of myfile.py: testvar = and I am trying to write a function that does something like this: def myfunction(filename):
3
by: Vinodh Kumar P | last post by:
What is call stack? I am sorry if its perceived as an off topic.
51
by: Richard Hengeveld | last post by:
Hi all, I'm trying to understand how pointers for function parameters work. As I understand it, if you got a function like: void f(int *i) { *i = 0; }
5
by: Seong-Kook Shin | last post by:
Hi, I'm reading Steve's "C Programming FAQs" in book version, and have two question regarding to Q11.16 ... Also, a `return' from `main' cannot be expected to work if data local to main might be...
11
by: Felix Kater | last post by:
Hi, I can compile and run this code (see below) which twice calls the function f, first with too less, second with too much arguments. But is it legal and free of memory leaks and other...
2
by: Dave Westerman | last post by:
I've got a Jython script where I'm doing an execfile() to pull in a small script that contains a function, which I then call. execfile(app_applscript) optionList = createOptionList(applOptions)...
1
by: moijes12 | last post by:
Hi i have 3 python files and i want to execute the files sequentially using the execfile command.Hence ,i have written the following program fileList = for fileName in fileList :...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.