Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - cannot execute binary file (Python 3.0.1)

 
Thread Tools Search this Thread
Old 03-01-2009, 08:04 AM   #1
Default cannot execute binary file (Python 3.0.1)


Greetings,
On Mac OS 10.5.6, I updated Python to version 3.0.1.
When I want to run a py file, I get an error:
xxx:~ xxx$ cd '/Users/xxx/Documents/programmingPractice/' && '/usr/
local/bin/python' '/Users/xxx/Documents/programmingPractice/
python_file.py' && echo Exit status: $? && exit 1
-bash: /usr/local/bin/python: cannot execute binary file

This wasn't an issue with Python 2.6, please let me know how to solve
this problem.
Best regards
Charly


cf29
  Reply With Quote
Old 03-01-2009, 08:14 AM   #2
Chris Rebert
 
Posts: n/a
Default Re: cannot execute binary file (Python 3.0.1)
On Sun, Mar 1, 2009 at 12:04 AM, cf29 <> wrote:
> Greetings,
> On Mac OS 10.5.6, I updated Python to version 3.0.1.
> When I want to run a py file, I get an error:
> xxx:~ xxx$ cd '/Users/xxx/Documents/programmingPractice/' && '/usr/
> local/bin/python' Â*'/Users/xxx/Documents/programmingPractice/
> python_file.py' Â*&& echo Exit status: $? && exit 1
> -bash: /usr/local/bin/python: cannot execute binary file
>
> This wasn't an issue with Python 2.6, please let me know how to solve
> this problem.


Detailing exactly how you upgraded Python would help immensely.

Cheers,
Chris

--
Follow the path of the Iguana...
http://rebertia.com


Chris Rebert
  Reply With Quote
Old 03-01-2009, 09:16 AM   #3
cf29
 
Posts: n/a
Default Re: cannot execute binary file (Python 3.0.1)
On Mar 1, 11:14*am, Chris Rebert <c...@rebertia.com> wrote:
> Detailing exactly how you upgraded Python would help immensely.
>
> Cheers,
> Chris


Thanks for your answer.
I installed the package in python-3.0.1-macosx2009-02-14.dmg
(downloaded from http://www.python.org/download/releases/3.0.1/) and
runed the Update Shell Profile.command situated in the Python 3.0
folder.

If I type python in the Terminal, it says: Python 3.0.1 (r301:69597,
Feb 14 2009, 19:03:52). So it seems that it is working properly.
If I use the Terminal and type: python myfile.py, it works as
expected.
The issue is when I want to run py file either with Python
Launcher.app or directly from BBEdit (the text editor i use). I get
the "cannot execute binary file" error.

In /usr/local/bin/ the python symbolic link is connected to Python v3

Charly http://cf29.com/


cf29
  Reply With Quote
Old 03-01-2009, 09:52 AM   #4
Ned Deily
 
Posts: n/a
Default Re: cannot execute binary file (Python 3.0.1)
In article
<b756d6fc-4959-4412-8bb7->,
cf29 <> wrote:
> On Mac OS 10.5.6, I updated Python to version 3.0.1.
> When I want to run a py file, I get an error:
> xxx:~ xxx$ cd '/Users/xxx/Documents/programmingPractice/' && '/usr/
> local/bin/python' '/Users/xxx/Documents/programmingPractice/
> python_file.py' && echo Exit status: $? && exit 1
> -bash: /usr/local/bin/python: cannot execute binary file
>
> This wasn't an issue with Python 2.6, please let me know how to solve
> this problem.


It appears you are trying to run a python script by double-clicking on
it and that Python Launcher.app is the default application associated
with .py files. The default setting in Python Launcher is to use the
python linked to /use/local/bin/pythonw. By default, the OS X 3.0.1
installer does not install or modify the links in /usr/local/bin/,
unlike 2.x installers. That is a problem for Python Launcher. Here are
a few options, assuming you used the 3.0.1 python.org installer:

1. You can start up the installer again, choose Customize, and then
select and install the "UNIX command-line tools" package.
/usr/local/bin/pythonw will now point out at python 3.0.1 rather than
python 2.6.

2. Launch Python Launcher and change its Preferences. Python Launcher
should be in the /Applications/Python 3.0 folder. Select Preferences
and in the Interpreter field enter the full path to python3.0, which is:
/Library/Frameworks/Python.framework/Versions/3.0/bin/python3.0

3. Use IDLE instead of Python Launcher to run scripts. Just launch IDLE
(it's also in /Applications/Python 3.0) and open the script file from
IDLE's menu bar. Or drag-drop the script onto the IDLE icon in the
Dock. If you want to be able to double-click on the file in the Finder,
you'll need to change the default application associated with .py files.
In a Finder window or the desktop select your python script file but
don't double-click it. Instead, choose the FInder's "Get Info" command
and in the resulting Info window choose IDLE 3.0.1 in the "Open with"
list. To open all .py files with IDLE, if necessary click on the
padlock in the lower right-hand corner of the Info window to
authenticate, then click on the Change All.. button.

4. Run your scripts in a terminal window using python3.0 from the shell
command line. You can use the above path to execute python; it might
help to create a shell alias for it. Or double-click on the Update
Shell Profile command in /Applications/Python 3.0 to cause python3.0 to
be added to your shell PATH and then just type python3.0.

I would recommend either (or both) of the last two approaches. You'll
be better off avoiding Python Launcher.

--
Ned Deily,




Ned Deily
  Reply With Quote
Old 03-01-2009, 10:34 AM   #5
cf29
 
Posts: n/a
Default Re: cannot execute binary file (Python 3.0.1)
On Mar 1, 12:52*pm, Ned Deily <n...@acm.org> wrote:
> It appears you are trying to run a python script by double-clicking on
> it and that Python Launcher.app is the default application associated
> with .py files. *The default setting in Python Launcher is to use the
> python linked to /use/local/bin/pythonw. *By default, the OS X 3.0.1
> installer does not install or modify the links in /usr/local/bin/,
> unlike 2.x installers. *That is a problem for Python Launcher. *Here are
> a few options, assuming you used the 3.0.1 python.org installer:
>
> 1. You can start up the installer again, choose Customize, and then
> select and install the "UNIX command-line tools" package. *
> /usr/local/bin/pythonw will now point out at python 3.0.1 rather than
> python 2.6.
>
> --
> *Ned Deily,
> *n...@acm.org



Thank you Ned! The 1. did the trick.
Actually I was using the open menu of Python Launcher to open my
files. And now it works fine.
Usually I use to run python scripts from BBEdit itself and this is now
working as expected.
What a great place to find answers! Thanks again.
Charly
http://cf29.com/


cf29
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
image (jpg,bmp,gif, etc.) convert to equivalent binary representation using vb.net? archieSupremo Software 0 09-06-2009 12:20 PM
Counting In Binary Raymond A+ Certification 13 03-07-2004 07:28 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46