Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm running jsunpack.py, after installing all dependencies and setting the correct path, I decided to test it. I run it as python jsunpack.py test.htm and it works fine, now when I try to sudo it I get:

error: Error: Fatal error in decodeJS: [Errno 2] No such file or directory (probably you are missing "js" in your path)

Which leads me to think I don't have the path set up in root. So I sudo su root and I echo the path only to see that it is indeed there. I'm thoroughly confused, does it have something to do with permissions?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Permanent Solution

It seems that you need to add a directory to your environmental PATH variable. It is possible that you've gotten that variable installed using your .bashrc.

What happens if you do this:

sudo su -
bash /home/**user**/.bashrc
python jsunpack.py test.htm

If this works for you, then you've probably installed the PATH variable to your user's bashrc and not root's bashrc. To solve this you can open the user's .bashrc file and look though your PATH declarations:

cat ~/.bashrc | grep PATH

If you find a line that shows the path that you're looking for, copy and paste that PATH into your /root/.bashrc.


Single Time Solution

If you're really lazy, just:

cd /dir/with/jsunpack.py
python jsunpack.py test.htm

I am not familiar with jsunpack, but this may help resolve your issue.

share|improve this answer
    
Again, the same, running it without sudo works fine, but running it with sudo doesn't work (I changed the path in profile and in /etc/bash.bashrc. Still, sudoing doesn't work. Also, I'm trying to run this on cron. I ended up giving cron a Path for the js binaries. But still would like to know how to fix this. –  Shelby. S Jul 16 '12 at 20:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.