I was looking for a simple way to load a simple python program from
another python program.
I tried
os.system(cabel)
The file name is cabel.py a csound instrument editor..
The error I am getting is
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\boa-constructor\test of
snake\Frame1.py", line 212, in OnCabelItems0Menu
os.system(cabel)
NameError: global name 'cabel' is not defined
Localisation of messages is disabled, using default language.
time resolution is 279.365 ns
This is with cabel in the current directory. I have managed to use
import to run it but it will only do it once. I may be able to use the
exec commands but I don't want to exit the program I am using only to
run other programs and then exit. I would also perfer that cabel is in
it's own directory.
thanks in advance for any help http://www.stormpages.com/edexter/csound.html 8 2245 Er*********@msn.com wrote:
I was looking for a simple way to load a simple python program from
another python program.
I tried
os.system(cabel)
The file name is cabel.py a csound instrument editor..
The error I am getting is
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\boa-constructor\test of
snake\Frame1.py", line 212, in OnCabelItems0Menu
os.system(cabel)
NameError: global name 'cabel' is not defined
Localisation of messages is disabled, using default language.
time resolution is 279.365 ns
This is with cabel in the current directory. I have managed to use
import to run it but it will only do it once. I may be able to use the
exec commands but I don't want to exit the program I am using only to
run other programs and then exit. I would also perfer that cabel is in
it's own directory.
thanks in advance for any help
http://www.stormpages.com/edexter/csound.html
Read the docs: os.system() takes a string. You're calling it with an
uninitialized variable name. Unless you have something like "cabel =
'cabel'" somewhere before your call os.system() you can expect that
error.
"import cabel" will only work once because python's module import
mechanism caches imported modules to save time when a script imports
them more than once. To force the module to be reloaded use the reload
function: "reload(cabel)"
os.system() docs: http://docs.python.org/lib/os-process.html#l2h-1692
(But see the subprocess module too: http://docs.python.org/lib/module-subprocess.html)
Peace,
~Simon
Hi Eric
Check that ".py" and ".pyw" are in your PATHEXT environment variable
(are you using Windows?). Then, if the folder that cabel is in is in
your PATH environment variable, and the correct association for .py
files is set up (i.e. they get run by python.exe),
either
os.system('cabel')
or
os.system('cabel.py')
should work.
Alternatively, you could not do any of those things, and run
os.system('python cabel.py')
with 'cabel.py' in the same folder as the parent script, and that
should work too, assuming that the path to your python executable is on
the PATH environment variable.
If you run other commands from python quite frequently, it is probably
a good idea to look into the "os.popen" set of commands, for more
flexibilty.
Caleb
Caleb Hattingh wrote:
Hi Eric
Check that ".py" and ".pyw" are in your PATHEXT environment variable
(are you using Windows?). Then, if the folder that cabel is in is in
your PATH environment variable, and the correct association for .py
files is set up (i.e. they get run by python.exe),
either
os.system('cabel')
or
os.system('cabel.py')
should work.
Alternatively, you could not do any of those things, and run
os.system('python cabel.py')
with 'cabel.py' in the same folder as the parent script, and that
should work too, assuming that the path to your python executable is on
the PATH environment variable.
If you run other commands from python quite frequently, it is probably
a good idea to look into the "os.popen" set of commands, for more
flexibilty.
Caleb
import cabel and reload(cabel) seem to work fine. I am not sure why I
am having trouble with os.system . Tells me it isn't a command.
thanks for the help, I will look into os.popen to see what it does.
would there be ay
Caleb Hattingh wrote:
Hi Eric
Check that ".py" and ".pyw" are in your PATHEXT environment variable
(are you using Windows?). Then, if the folder that cabel is in is in
your PATH environment variable, and the correct association for .py
files is set up (i.e. they get run by python.exe),
either
os.system('cabel')
or
os.system('cabel.py')
should work.
Alternatively, you could not do any of those things, and run
os.system('python cabel.py')
with 'cabel.py' in the same folder as the parent script, and that
should work too, assuming that the path to your python executable is on
the PATH environment variable.
If you run other commands from python quite frequently, it is probably
a good idea to look into the "os.popen" set of commands, for more
flexibilty.
Caleb
import cabel and reload(cabel) seem to work fine. I am not sure why I
am having trouble with os.system, probily something to do with the
path. Is one better than the other when it comes to distributing
software?? Thanks for the help. Hopefully this message I get isn't
anything important.. (I will have to look into os.popen later.
Localisation of messages is disabled, using default language.
time resolution is 279.365 ns
Try this:
import os
os.startfile('cabel.py')
This should work with any program or file, not only python ones.
Hope this helps,
Luis Er*********@msn.com wrote:
I was looking for a simple way to load a simple python program from
another python program.
I tried
os.system(cabel)
The file name is cabel.py a csound instrument editor..
The error I am getting is
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\boa-constructor\test of
snake\Frame1.py", line 212, in OnCabelItems0Menu
os.system(cabel)
NameError: global name 'cabel' is not defined
Localisation of messages is disabled, using default language.
time resolution is 279.365 ns
This is with cabel in the current directory. I have managed to use
import to run it but it will only do it once. I may be able to use the
exec commands but I don't want to exit the program I am using only to
run other programs and then exit. I would also perfer that cabel is in
it's own directory.
thanks in advance for any help
http://www.stormpages.com/edexter/csound.html
I am new to Python coding myself, but I've found that the easiest way to
start another script from within a script, is to use the
execfile('filename.py') command.
There may be better ways of loading other Python scripts -- better ways that
I'm not yet aware of -- but execfile() works for me.
--
--
There are several things that I will never be:
* I will never be attracted to females.
* I will never enjoy the company of others.
Exactly how these realities bode for my enemy, is not of my concern.
At Sunday 13/8/2006 16:51, Er*********@msn.com wrote:
I was looking for a simple way to load a simple python program from another python program.
I tried
os.system(cabel)
The file name is cabel.py a csound instrument editor..
NameError: global name 'cabel' is not defined
Have you tried os.system("cabel.py")
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! http://www.yahoo.com.ar/respuestas
Gabriel Genellina wrote:
At Sunday 13/8/2006 16:51, Er*********@msn.com wrote:
I was looking for a simple way to load a simple python program from
another python program.
I tried
os.system(cabel)
The file name is cabel.py a csound instrument editor..
NameError: global name 'cabel' is not defined
Have you tried os.system("cabel.py")
That did not seem to work, os.startfile worked great. I haven't tried
passing commands to csound with it yet but maybe os.sytem will work
better with that than it did python since I got the idea to use that to
pass arguments to them from a csound example. won't have time until
this weekend to try that though, or the exec(file).. http://www.stormpages.com/edexter/csound.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chris Gray |
last post by:
Is there such a beast? In particular, I'm looking for a
production-quality proxy server fully compliant with HTTP/1.1 written in
Python.
If there isn't, is there anything that comes close?
...
|
by: Paul Miller |
last post by:
Some background first - we have some software that embeds a Python
interpreter into a host application. Scripts are loaded dynamically and
used. But we want to support the ability to edit scripts...
|
by: Martin MOKREJ© |
last post by:
Hi,
I'm looking for some easy way to do something like include in c or PHP.
Imagine I would like to have:
cat somefile.py
a = 222
b = 111
c = 9
|
by: max(01)* |
last post by:
hello.
i wrote a very simple tkinter demo program that uses menus, buttons,
labels, entries, frames and secondary toplevels.
it is a python version of a java program made by a colleague.
...
|
by: JKop |
last post by:
Take the following simple function:
unsigned long Plus5Percent(unsigned long input)
{
return ( input + input / 20 );
}
Do yous ever consider the possibly more efficent:
|
by: Jack |
last post by:
Basically I am trying to find a high performance web server. Since
Python is installed on all of the servers, It'll be great if the web
server is written in Python as well. Otherwise, I will have...
|
by: John Henry |
last post by:
I am looking for a ready made simple graph package. I found an
extensive one in the piana package but when I try to use just the
graph portion, it fails to load because of the line:
class...
|
by: true911m |
last post by:
This is a simple walkthrough to get PyInstaller up and running.
I decided to give PI a try, because it claims to be more selective about what it bundles into its executable files by default, and...
|
by: W. Watson |
last post by:
See Subject. It's a simple txt file, each line is a Python stmt, but I need
up to four digits added to each line with a space between the number field
and the text. Perhaps someone has already done...
|
by: Rina0 |
last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
| |