Executable Scripts - Won't Execute?

This is the place for queries that don't fit in any of the other categories.

Executable Scripts - Won't Execute?

Postby JTeagle » Sat Apr 05, 2014 11:13 am

In the book Raspberry Pi User Guide which is where I've learned my initial Python from, it gave directions on making the hello world script executable, so that it could be run using

./helloworld.py

This did indeed work. However, when I tried that on my own script (which is a bit more than a simple print - it has imports, creates an object that it dels at the end, and calls functions in that object), trying to execute it after marking it as executable with chmod gives:

: No such file or directory

What have I done wrong or overlooked? The imports are only to sys, time and one file in the same directory.

(It does include

#!/usr/bin/env python

at the start.)
JTeagle
 
Posts: 4
Joined: Sat Apr 05, 2014 8:16 am

Re: Executable Scripts - Won't Execute?

Postby metulburr » Sat Apr 05, 2014 11:25 am

However, when I tried that on my own script (which is a bit more than a simple print - it has imports, creates an object that it dels at the end, and calls functions in that object),

It doesnt matter the code inside the file to make it executable.

trying to execute it after marking it as executable with chmod gives:

: No such file or directory

What is the exact command you gave? it should be:
Code: Select all
sudo chmod +x helloworld.py

show the command, directory, directory contents, and any output from your commands.

one file in the same directory.

are you in the same working directory chmod'ing the correct file in the correct diretory?
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1388
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Executable Scripts - Won't Execute?

Postby JTeagle » Tue Apr 08, 2014 2:59 pm

Sorry, for some reason this forum didn't notify me of replies.

The chmod part worked - by listing the file with its permissions I can see that all groups have the executable bit. The chmod, the call by specifying the file as a param to 'python' and the attempt to execute the file directly were all done from the directory that the file sits in.

When I next have chance to connect to the robot I'll try to narrow down the problem to a few files and then post the samples.
JTeagle
 
Posts: 4
Joined: Sat Apr 05, 2014 8:16 am


Return to General Coding Help

Who is online

Users browsing this forum: snippsat and 5 guests