473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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(current, "files") #joins current path with path
files
for filename in os.listdir(files): #checks every file in DIR: files
os.chdir(files) #changes dir 2 files
file2 = win32file.CreateFile(filename, win32file.GENERIC_READ, \
0, None, win32file.OPEN_EXISTING, 0, None ) #opens hexbin file
filename2 = filename+".exe" #changes filename to .exe extention
binhex.HexBin(file2, filename2) #translate hexed file 2 binary

If I run this one, an exeption is raised:

Traceback (most recent call last):
File
"C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py" ,
line 407, in ImportFile
exec codeObj in __main__.__dict__
File "<auto import>", line 1, in ?
File "C:\WINDOWS\temp123\Stuf\all2.py", line 9, in ?
binhex.HexBin(file2, 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

Jul 18 '05 #1
2 1638
Sorry that I double posted the message...

I thougd that the newsserver wasn't working

Sorry
"MaximusBrood" <topmas38({[AT]})hotmail({[DOT]})com> schreef in bericht
news:40*********************@reader1.nntp.hccnet.n l...
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(current, "files") #joins current path with path
files
for filename in os.listdir(files): #checks every file in DIR: files
os.chdir(files) #changes dir 2 files
file2 = win32file.CreateFile(filename, win32file.GENERIC_READ, \
0, None, win32file.OPEN_EXISTING, 0, None ) #opens hexbin file
filename2 = filename+".exe" #changes filename to .exe extention
binhex.HexBin(file2, filename2) #translate hexed file 2 binary

If I run this one, an exeption is raised:

Traceback (most recent call last):
File
"C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py" ,
line 407, in ImportFile
exec codeObj in __main__.__dict__
File "<auto import>", line 1, in ?
File "C:\WINDOWS\temp123\Stuf\all2.py", line 9, in ?
binhex.HexBin(file2, 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

Jul 18 '05 #2
On Mon, 31 May 2004 11:55:59 +0200, "MaximusBrood"
<topmas38({[AT]})hotmail({[DOT]})com> wrote:

binhex.HexBin(file2, filename2) #translate hexed file 2 binary
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.
<{{{*>


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
0
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent...
117
by: Peter Olcott | last post by:
www.halting-problem.com
6
by: Donal McWeeney | last post by:
Hi, I'm processing a document using XmlDocument and I have an XmlNode whose value is stored as a binhex encoded string... How can I get this string converted back to a byte... XmlConvert...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.