Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8945637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:17:35+00:00 2026-06-15T12:17:35+00:00

I have some python file in windows , and I transfer them to my

  • 0

I have some python file in windows, and I transfer them to my gentoo by samba.

I check their mode is executable, and I use ./xxx.py to run it, but get an error:

: No such file or directory

I am troubled that it does not prompt what file is not here.

but when I use python xxx.py, it can run in the right way.

and then I check the CR character by use set ff in vim, and found it is dos, then I use set ff=unix to set it, now it can run by using ./xxx.py

but I don’t know why it can be use python xxx.py when ff=dos?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:17:39+00:00Added an answer on June 15, 2026 at 12:17 pm

    DOS files ends lines with CR+LF, Unix files just with LF. This means that when Unix reads your file to figure out what the executable name is, that executable’s name ends in CR. Like so:

    #!/usr/bin/python
    
    print("Blah!")
    

    When I run that I get:

    $ ./test.py 
    bash: ./test.py: /usr/bin/python^M: bad interpreter: No such file or directory
    

    What happens in your case is that the CR character (the ^M above) is not printed out but “executed” by your terminal, i.e., the cursor will return to the start of the line. Hence, everything before the ^M is overwritten:

    $ ./test.py 
    

    : bad interpreter: No such file or directory

    This is why you can’t execute files with DOS file ending on Unix.

    Any even remotely modern source control system will handle this for you, and change the file endings when you check out the source.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to work with some long file paths (Windows) in Python and have
I just started using/learning Python and have some questions. I have a text file
I'm having some trouble with Mongodb and Python (Flask). I have this api.py file,
I want to delete some files with python scripts (while using Windows). I have
I'm working on Windows with Python 2.6.1. I have a Unicode UTF-16 text file
I have some python code that I wrote to convert a python list into
I have some python code using shutil.copyfile: import os import shutil src='C:\Documents and Settings\user\Desktop\FilesPy'
I have some python code that currently performs expensive computation by performing the computation
I have some python modules containing mostly functions and a few classes. Each one
I have written some Python scripts in Eclipse where at some point I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.