Thanks for feedback.
This function works perfectly if I put it in c:\python21\lib
but I'm going to write a bunch of different ones and need a way
to keep them organized (other than stuffing them all in ..\lib).
Here is the signon function. All it does it print the string
that is passed to it with Day, date, and time appended to it
preceded by a line of dashes. I use it at the top of most
programs to show program name, date and time as first output
from the program.
-----------------signon module----------------------------
import time
def signon (pstring):
print ""
printstring=pstring+" "+time.ctime(time.time())
print len(printstring)*"-","\n",printstring,"\n"
return
-----------------------------------------------------------
I interactively typed in the following lines:
from mylibrary.utils import signon # (no error)
help(signon) # shows me what I expect
# Python knows about the module
signon("test")
and I get the error message.
It is not just this function, it is any working module that I put
in the package subdirectory.
Regards,
Larry Bates
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, June 25, 2001 2:07 PM
To: [EMAIL PROTECTED]
Subject: ActivePython digest, Vol 1 #181 - 1 msg
Send ActivePython mailing list submissions to
[EMAIL PROTECTED]
To subscribe or unsubscribe via the World Wide Web, visit
http://listserv.ActiveState.com/mailman/listinfo/activepython
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of ActivePython digest..."
Today's Topics:
1. RE: Newbie & package setup (Patrick K. O'Brien)
--__--__--
Message: 1
Reply-To: <[EMAIL PROTECTED]>
From: "Patrick K. O'Brien" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: RE: Newbie & package setup
Date: Mon, 25 Jun 2001 13:47:39 -0500
What was the line of code you tried to run interactively when you got the
error? I think that is where the problem lies, not with your organization. I
suspect you didn't actually call a function in signon. For example, did you
actually try something like:
>>> from mylibrary.utils import signon
>>> signon.myfunction()
If this didn't help, you need to let us know what signon actually contains?
If it is small enough perhaps you could paste the source in your reply.
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Larry Bates
Sent: Monday, June 25, 2001 12:59 PM
To: [EMAIL PROTECTED]
Subject: Newbie & package setup
I wish to put the modules that I write that will be used in other Python
programs in the following directory structure:
c:\mylibrary------+
|
|
+-----utils--- utility modules (signon, read_ini
modules)
|
|
|
+-----ACCPAC---ACCPAC classes
.
.
.
I created __init__.py in c:\mylibrary (contents below)
#-----------------------------------------------------
# mylibrary package
#
# package placeholder
#
#
#-----------------------------------------------------
I created __init__.py in c:\mylibrary\utils (contents below)
#-----------------------------------------------------------
# mylibrary.utils
#
# package placeholder
#
# List of all modules in this package
#
__all__ = ["signon", "read_ini", "fmt_currency"]
#------------------------------------------------------------
within Python I can type:
from mylibrary.utils import signon
and it loads the signon module. I can type help(signon) and it displays
proper information.
Problem: When I attempt to use any imported functions I get the following
error
message:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: object is not callable: <module 'mylibrary.utils.signon' from
'c:\python21\mylibrary\utils\signon.pyc'>
I have searched high and low for what I'm missing, but I just can't seem to
put
my finger on what is wrong.
Thanks in advance for any assistance.
Regards,
Larry Bates
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython
--__--__--
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython
End of ActivePython Digest
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython