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 8954351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:18:06+00:00 2026-06-15T14:18:06+00:00

import commands import os import pickle def readDir(): directory = raw_input(‘In which folder would

  • 0
import commands
import os
import pickle

def readDir():
    directory = raw_input('In which folder would you like to save the files?? \n')
    if(os.path.exists(directory)):
            print 'Error!! Please give an other name '
            directory = raw_input('In which folder would you like to save the file??\n')
            os.mkdir(directory)
            os.chdir(directory)
    else:
        os.mkdir(directory)
        os.chdir(directory)


readDir()
url = raw_input('Which url are you aiming at ?\n')
tmp = open('tempo.txt','w');
tmp.writelines(url)
tmp.close()
tmp = open('tempo.txt','r');
link = tmp.read()
os.system(" curl " + link +"| egrep -o 'http:.*All\.ram'  > final.txt  ")



infile = open('final.txt', 'r')
outfile = open('tmp.txt', 'w')



for line in infile:

outfile = open('tmp.txt', 'w')
key = line
list = key.split("/")
dir = list[6]
outfile.writelines(key)
outfile.close()
open('tmp.txt','r')
os.system("cat tmp.txt | xargs -n1 -i curl {} > links")
os.system("wget -P %s -i links" %dir)

infile.close()
outfile.close()
os.remove(outfile.name)
os.remove('links')
os.remove(tmp.name)

Error: I just used google as an example.

Which url are you aiming at ?
google.com
'curl' is not recognized as an internal or external command, operable program or batch file.
Traceback (most recent call last):
File "C:\Users\User\Desktop\download.py", line 52, in <module>
infile = open('final.txt', 'r')
IOError: [Errno 2] No such file or directory: 'final.txt'
  • 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-15T14:18:07+00:00Added an answer on June 15, 2026 at 2:18 pm

    Issues that I see:

    1. curl doesn’t seem to be installed on your local machine. Not sure why you want to make a system call for only grabbing a URL anyways…
    2. As you don’t have curl installed, then no final.txt was ever created. When you try to load it later on in the system, it doesn’t work.

    Bottom line, find a way to do this without using curl, and you’ll be better off.

    os.system(" curl " + link +"| egrep -o 'http:.*All\.ram'  > final.txt  ")
    

    Looking more closely, it looks like you just want to download the file. It’s a lot easier to do this with a urllib directly. I’ll copy a simple example from the python docs, and let you figure out how to use it from there. Note, there’s a large difference on how to do this if you are using python 2 or 3, so just be warned…

    >>> import urllib
    >>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
    >>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query?%s" % params)
    >>> print f.read()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a directory which I would like to be the default for Python
I've inserted some shell commands into python script like below: #!/usr/bin/python import os,sys,re import
I've added a .pythonrc.py script to my home directory with the commands below: import
So, I created a simple python module, test.py import commands def main(): cmd =
Ubuntu Server 9.10, Here is my file, test.py import commands blkid = commands.getoutput('blkid') print
I have this simple twill code >>> from twill.commands import * >>> go(http://stackoverflow.com:80) ==>
Trying to execute shell command in background using pythons commands module >>>import commands >>>output
import twill twill.commands.agent(Mozilla/5.0 (Windows NT 6.2; WOW64; rv:15.0) Gecko/20120910144328 Firefox/15.0.2) twill.commands.go('loginpage...') twill.commands.fv(1, txtUserName, username)
I am trying to import a large amount of .dmp files in a MySQL
I'm trying to run a series of commands for two input files, but I

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.