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

  • Home
  • SEARCH
  • 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 825635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:17:16+00:00 2026-05-15T03:17:16+00:00

I didn’t think this would be as tricky as it turned out to be,

  • 0

I didn’t think this would be as tricky as it turned out to be, but here I am. I’m trying to write a Nautilus script in Python to upload one or more images to Imgur just by selecting and right clicking them. It works well enough with both single images and multiple images – as long as they don’t contain any whitespace. In fact, you can upload a single image containing whitespace, just not multiple ones.

The problem is that NAUTILUS_SCRIPT_SELECTED_FILE_PATHS returns all the selected files and directories as a space separated string. So for example, it could look like this:

print os.environment['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS']
/home/nevon/Desktop/test image.png /home/nevon/Desktop/test.jpg

What I need is a way to -either in bash or Python- escape the spaces in the path – but not the spaces that delimit different items. Either that, or a way to put quotation marks around each item.

The ultimate solution would be if I could do that in bash and then send the items as separate arguments to my python script. Something like:

python uploader.py /home/nevon/Desktop/test\ image.png /home/nevon/Desktop/test.jpg

I’ve tried RTFM’ing, but there doesn’t seem to be a lot of good solutions for this. At least not that I’ve found. Any ideas?

  • 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-05-15T03:17:17+00:00Added an answer on May 15, 2026 at 3:17 am

    I think that $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS should be newline delimited, not space delimited. In that case, the following should work from bash:

    echo -e $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS | xargs python uploader.py 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Didn't even know how to exactly phrase this question, but here is the the
I've seen several posts for this issue but didn't found my solution. I'm trying
They didn't mention this in python documentation. And recently I'm testing a website simply
Sorry i really didn't know how to phrase the question any better but here
Didn't see a question similar to this, so here goes: Let's say I'm running
I've read all the questions regarding this issue but didn't manage to solve it...
i was looking for similar title here but i didn't find much info, so
I asked this kind of question before, but didn't receive any good answers, perhaps
i searched for something similar here, but didn't found a clue about what's going
I didn't find any question like this here. Yesterday I finally got Gingerbread 2.3.4

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.