first post: new to pythong. some questions.
Hello. Im brand new to this list and to python. Ive recently started reading about it
and am now in the tinkering stage. I have a script im working on that i need some
asistance debugging. Its super small and should be a snap for you gurus =)
I have 2 files in a dir off my home dir:
mkoneurl.py
make_ou_class.py
--mkoneurl.py--
#! /usr/bin/env python
import make_ou_class
run = makeoneurl()
-
--make_ou_class.py--
class makeoneurl:
def __init__():
self.commandline()
def commandline():
com = str(raw_input(":"))
#Parse out any params and aguements - reg expressions
#params[] array to hold paramters
params = 0
if com == "ou":
self.ou(params)
else:
print com + " unknown command."
def ou(parameter):
print "hello world"
self.commandline():
---
Why i run mkoneurl.py by typing "python mkonurl.py" i get the following error:
Traceback (innermost last):
File "mkoneurl.py", line 5, in ?
run = makeoneurl()
NameError: makeoneurl
am i missing something here? Any help would be greatly appreciated. Thank you
--Shawn
--
http://mail.python.org/mailman/listinfo/python-list
TypeError: no arguments expected
I havet these 2 files in the same dir. This is code im writing to learn pythong
mkoneurl.py:
#! /usr/bin/env python
import make_ou_class
run = make_ou_class.makeoneurl()
make_ou_class.py:
class makeoneurl:
def __init__():
self.commandline()
def commandline():
com = raw_input(":")
#Parse out any params and aguements - reg expressions
#params[] array to hold paramters
params = 0
if com == "ou":
self.ou(params)
else:
print com + " unknown command."
def ou(params):
print "hello world"
self.commandline()
===
when i run the script like this: python mkoneurl.py
I get this error:
Traceback (innermost last):
File "mkoneurl.py", line 5, in ?
run = make_ou_class.makeoneurl()
TypeError: no arguments expected
Ive looked around for this exeption but nothing ive read has help in
this situation.
Any of your thoughts are greatly apprectiated. THANK!!
--shawn
--
http://mail.python.org/mailman/listinfo/python-list
Re: TypeError: no arguments expected
thanks for all your input. Ive gotten it to work thanks! --shawn On 12/12/05, Steve Holden <[EMAIL PROTECTED]> wrote: > Dennis Lee Bieber wrote: > > On Sun, 11 Dec 2005 22:00:55 -0500, shawn a <[EMAIL PROTECTED]> > > declaimed the following in comp.lang.python: > > > > > >>I havet these 2 files in the same dir. This is code im writing to learn > >>pythong > >>mkoneurl.py: > >>#! /usr/bin/env python > >> > >>import make_ou_class > >> > >>run = make_ou_class.makeoneurl() > > > > > > Okay, you've just defined a "run" object that contains an instance > > of "makeoneurl"... What do you expect it to do? > > > Let's get the terminology right: sloppy terminology leads to sloppy > thinking. The statement binds the name "run" to a newly-created > "make_one_url" instance. Remember, "run" isn't an object, it's a > reference to an object like all Python names. > > > >> > >>make_ou_class.py: > >> > > > > Well, first off... You need to /supply/ a placeholder for "self". > > ALL methods of a class receive the instance as the first argument. So... > > > Again you need to be a little careful here, since we now have class > methods and static methods to cloud the picture. So it would be more > accurate to say that "instance methods are all automatically called with > a reference to the instance as the first argument; it is conventional to > use the name 'self' to refer to the instance". > > > [...] > > regards > Steve > -- > Steve Holden +44 150 684 7255 +1 800 494 3119 > Holden Web LLC www.holdenweb.com > PyCon TX 2006 www.python.org/pycon/ > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
