binhex problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MaximusBrood

    binhex problem

    Hi,

    Im a newcomer to Python and I've got some error that I totaly dont
    understand.

    I've made a program that is made to extract a couple of binhex files.

    Here is my sourccode:

    import binhex, os
    current = os.getcwd() #Gets current cwd
    files = os.path.join(cu rrent, "files") #joins current path with path
    files
    for filename in os.listdir(file s): #checks every file in DIR: files
    os.chdir(files) #changes dir 2 files
    file2 = win32file.Creat eFile(filename, win32file.GENER IC_READ, \
    0, None, win32file.OPEN_ EXISTING, 0, None ) #opens hexbin file
    filename2 = filename+".exe" #changes filename to .exe extention
    binhex.HexBin(f ile2, filename2) #translate hexed file 2 binary

    If I run this one, an exeption is raised:

    Traceback (most recent call last):
    File
    "C:\Python23\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",
    line 407, in ImportFile
    exec codeObj in __main__.__dict __
    File "<auto import>", line 1, in ?
    File "C:\WINDOWS\tem p123\Stuf\all2. py", line 9, in ?
    binhex.HexBin(f ile2, filename2) #translate hexed file 2 binary
    TypeError: __init__() takes exactly 2 arguments (3 given)

    I've got only 2 arguments, but python thinks I've got there 3...

    Can anybody help me? (maybe its a stupid question but i'm only a newbie =) )
    I'm running on Win XP Home



  • MaximusBrood

    #2
    Re: binhex problem

    Sorry that I double posted the message...

    I thougd that the newsserver wasn't working

    Sorry


    "MaximusBro od" <topmas38({[AT]})hotmail({[DOT]})com> schreef in bericht
    news:40bb012e$0 $136$3a628fcd@r eader1.nntp.hcc net.nl...[color=blue]
    > Hi,
    >
    > Im a newcomer to Python and I've got some error that I totaly dont
    > understand.
    >
    > I've made a program that is made to extract a couple of binhex files.
    >
    > Here is my sourccode:
    >
    > import binhex, os
    > current = os.getcwd() #Gets current cwd
    > files = os.path.join(cu rrent, "files") #joins current path with path
    > files
    > for filename in os.listdir(file s): #checks every file in DIR: files
    > os.chdir(files) #changes dir 2 files
    > file2 = win32file.Creat eFile(filename, win32file.GENER IC_READ, \
    > 0, None, win32file.OPEN_ EXISTING, 0, None ) #opens hexbin file
    > filename2 = filename+".exe" #changes filename to .exe extention
    > binhex.HexBin(f ile2, filename2) #translate hexed file 2 binary
    >
    > If I run this one, an exeption is raised:
    >
    > Traceback (most recent call last):
    > File
    > "C:\Python23\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",
    > line 407, in ImportFile
    > exec codeObj in __main__.__dict __
    > File "<auto import>", line 1, in ?
    > File "C:\WINDOWS\tem p123\Stuf\all2. py", line 9, in ?
    > binhex.HexBin(f ile2, filename2) #translate hexed file 2 binary
    > TypeError: __init__() takes exactly 2 arguments (3 given)
    >
    > I've got only 2 arguments, but python thinks I've got there 3...
    >
    > Can anybody help me? (maybe its a stupid question but i'm only a newbie[/color]
    =) )[color=blue]
    > I'm running on Win XP Home
    >
    >
    >[/color]


    Comment

    • fishboy

      #3
      Re: binhex problem

      On Mon, 31 May 2004 11:55:59 +0200, "MaximusBro od"
      <topmas38({[AT]})hotmail({[DOT]})com> wrote:

      [color=blue]
      >binhex.HexBin( file2, filename2) #translate hexed file 2 binary[/color]

      I think you meant binhex.hexbin(. .)

      HexBin is a class inside Lib/binhex.py, which is why you're getting
      that __init__ error.

      hexbin() is the function to translate infile to outfile.
      [color=blue]
      ><{{{*>[/color]

      Comment

      Working...