Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

[SOLVED] Python exec/hack problem.

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
5 posts • Page 1 of 1
Author
Message
Charlie.
n00b
n00b
Posts: 72
Joined: Sun Jan 21, 2007 6:50 pm
Location: Port Elizabeth, South Africa
Contact:
Contact Charlie.
Website

[SOLVED] Python exec/hack problem.

  • Quote

Post by Charlie. » Sun Nov 02, 2008 10:00 am

Why does this script yield "No such file or directory" when I execute it directly, yet it works when I pass the file to python as a command-line argument?

Code: Select all

#!/usr/bin/env python
print "Hello World!"
It seems the exec/hack on the first line isn't working.
Last edited by Charlie. on Mon Nov 03, 2008 7:11 am, edited 1 time in total.
Prismatic Art: http://prismatic.wordpress.com/
Top
Elbar Thera
n00b
n00b
Posts: 60
Joined: Thu May 15, 2008 9:04 am

  • Quote

Post by Elbar Thera » Sun Nov 02, 2008 11:56 am

Well, it does work here, but it didn't on my first try because i misspelled python :wink:

Greets,
Elbar
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Sun Nov 02, 2008 12:20 pm

what did you name the script?
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
Charlie.
n00b
n00b
Posts: 72
Joined: Sun Jan 21, 2007 6:50 pm
Location: Port Elizabeth, South Africa
Contact:
Contact Charlie.
Website

  • Quote

Post by Charlie. » Mon Nov 03, 2008 7:10 am

I found the issue - wrong line endings.

The script had Windows CR-LF line endings and was encoded in UTF-8. Opening it up in Mousepad and saving it with LF-only line endings solved the issue.

Naib - With the exec/hack, the file extension shouldn't matter. (If that's what you're getting at...)
Prismatic Art: http://prismatic.wordpress.com/
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Mon Nov 03, 2008 9:31 am

Charlie. wrote:
Naib - With the exec/hack, the file extension shouldn't matter. (If that's what you're getting at...)
Na, I was getting at if you called the script the name of a python extension file. When I started playing with pyserial I had a test script called serial.py and NOTHING would work
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
Post Reply

5 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic