Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Script Problem' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Script Problem
Authored by: amaloney on May 30, '07 11:03:22AM

When I tried to run the script I got

Traceback (most recent call last):
File "./rip.py", line 6, in ?
from subprocess import Popen
ImportError: No module named subprocess

I am a newbie with scripting.

I am running Mac OS X 10.4.9
I placed HandBrakeCLI in /usr/local/bin

I ran the OS X installer for Python 2.5.1.
It created /Applications/MacPython 2.5 which contains Python Launcher.app

I copied the script to TextWrangler 2.2.1 and saved it as rip.py in a directory /Applications/A_Rip_Stoff

In Terminal I ran chmod +x rip.py

I then ran ./rip.py and got the above msg.

What am I doing wrong?

Al Maloney



[ Reply to This | # ]
Script Problem
Authored by: simonpie on May 30, '07 11:32:05AM

Well you need to install the subprocess module, it is not installed by default.



[ Reply to This | # ]
Script Problem
Authored by: amaloney on May 30, '07 12:12:27PM

Install subprocess module ???

I guess I am out of my league here.
I'll put myself on hold for a while.
I'm afraid I might screw up things in my ignorance.

Thanks anyway
Al



[ Reply to This | # ]
Script Problem
Authored by: simonpie on May 30, '07 06:46:59PM
Script Problem
Authored by: berndtj on May 30, '07 06:54:20PM

The issue is that the script is still running python 2.3. The subprocess module is part of python 2.4+, hence the dependence.

After you install python 2.4 or 2.5, you will need to change the link to python in /usr/bin

from the terminal type "ls -la | grep python", you will see what I mean.

To fix this just do the following:

sudo mv python python.old

sudo ln -s /Library/Frameworks/Python.framework/Versions/Current/bin/python python

sudo rm python.old

Once you do this, the script should work. If you don't want to muck with the links in /usr/bin, you can replace the first line of the script from:
#!/usr/bin/python
to:
#!/Library/Frameworks/Python.framework/Versions/Current/bin/python

Hope that helps.



[ Reply to This | # ]
Script Problem
Authored by: robgmann on May 30, '07 10:13:18PM

I was able to get the script to start by making sure #!/usr/bin/python was on the first line of the script. (When I pasted it from the hint, it wasn't the first line).

Then it reads the DVD for a minute and outputs:
........................................nripping: chapter 0 (0s)
.nyou totally ripped! (0:1:40 total time)

No output file is created, i.e. nothing appears to have happened.
Is there a simple way to see diagnostics of this script?
So far, it seems no one has had success making it run.




[ Reply to This | # ]
Script Problem
Authored by: berndtj on May 30, '07 10:30:24PM

Hmmm.

Well you can run HandBrakeCLI stand alone, and see if it works. From the output you show, it appears that the scanning did not return anything.

Try:

HandBrakeCLI /Volumes/your_dvd -t 0

You should see a bunch of output. The script parses this output to return the longest title.



[ Reply to This | # ]
Script Problem
Authored by: robgmann on Jun 01, '07 08:13:29AM
Still not getting it... here is my command and output:
HandBrakeCLI -i /Volumes/WW_S3_D4/ -t0

HandBrake 0.8.5b1 (2007042001) - http://handbrake.m0k.org/
1 CPU detected
Opening /Volumes/WW_S3_D4/...
Scanning title 1 of 13...
Scanning title 2 of 13...
Scanning title 3 of 13...
Scanning title 7 of 13...
Scanning title 8 of 13...
Scanning title 9 of 13...
Scanning title 10 of 13...
Scanning title 13 of 13...
No title found.
HandBrake has exited.

And when I run the script, I still just get
./scripts/rip.py /Volumes/SHARED/shared/Ripped/
.........nripping: chapter 0 (0s)
.nyou totally ripped! (0:1:9 total time)
sh: line 1: growlnotify: command not found



[ Reply to This | # ]
Script Problem
Authored by: berndtj on Jun 01, '07 08:18:56AM

"No title found" sounds like HandBrake is having trouble reading the DVD properly. Try it with a different DVD.



[ Reply to This | # ]