Hi everyone, I get a problem when using binhex module

Dave Angel davea at ieee.org
Thu Aug 20 17:08:07 CEST 2009


Yan Jian wrote:
> Below is what I copy from the Internet:
>
> import binhex
> import sys
>
> infile = "in.txt"
>
> binhex.binhex(infile, sys.stdout)
>
> Every time I try to run this script, I get a message saying
>
> Traceback (most recent call last):
>   File "D:\eclipse_workspace\encode\src\binhex.sample.py", line 6, in
> <module>
>     import binhex
>   File "C:\Python25\lib\binhex.py", line 12, in <module>
>     # easy interface should work "as expected" on any platform.
> TypeError: 'module' object is not callable
>
> Does anyone encounter similar situation. Thank you for your help?
>
>   
First question:   Are you running Python2.5 ?  And do you actually have 
it installed in c:\Python25 directory?

Do you in fact have 5 blank lines in front of the "import binhex" line?

Assuming yes for all of those, the only cause I can figure for that 
particular error string is that  binhex.pyc is out of synch with 
binhex.py.   To test that theory, try deleting it (in general that means 
renaming it temporarily, so you could restore it if I'm wrong), and 
running again.

I would also add the lines:
   import sys
   print  sys.version

in front of the import, just to make sure you're running what you think 
you are.  And then I'd get a console prompt, change directory to

D:\eclipse_workspace\encode\src\binhex

and run  sample.py  from that command prompt.

Compare the two version strings, and see if anything's different in the 
two error messages.

DaveA



More information about the Python-list mailing list