Cansand
Structural
- Jan 14, 2007
- 102
I am learning Python... while going through a simple example in the Doc
I have copied the statements below into a file called distance.py in my local directory C.
Then (as instructed in the ABAQUS Doc) I typied the following at the system prompt:
abaqus python distance.py 30 40
but the ABAQUS\6.5.1\cae\python.exe: can't open file'distance'
can anybody tell me why. in addition what are '30 40' for in the statement abaqus python distance.py 30 40
import sys, math
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def distance(x, y):
"""
Prints distance from origin to (x, y).
Takes two command line arguments, x and y.
"""
# Square the arguments and add them.
a = x**2 + y**2
# Return the square root.
return math.sqrt(a)
# Retrieve the command line arguments and
# convert the strings to floating-point numbers.
x = float(sys.argv[1])
y = float(sys.argv[2])
# Call the distance function.
d = distance(x, y)
# Print the result.
print 'Distance to origin = ', d
I have copied the statements below into a file called distance.py in my local directory C.
Then (as instructed in the ABAQUS Doc) I typied the following at the system prompt:
abaqus python distance.py 30 40
but the ABAQUS\6.5.1\cae\python.exe: can't open file'distance'
can anybody tell me why. in addition what are '30 40' for in the statement abaqus python distance.py 30 40
import sys, math
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def distance(x, y):
"""
Prints distance from origin to (x, y).
Takes two command line arguments, x and y.
"""
# Square the arguments and add them.
a = x**2 + y**2
# Return the square root.
return math.sqrt(a)
# Retrieve the command line arguments and
# convert the strings to floating-point numbers.
x = float(sys.argv[1])
y = float(sys.argv[2])
# Call the distance function.
d = distance(x, y)
# Print the result.
print 'Distance to origin = ', d