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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:52:28+00:00 2026-06-18T05:52:28+00:00

So this is the script i am running which gives output fine in windows

  • 0

So this is the script i am running which gives output fine in windows but in ubuntu,
it just prints a empty list

import urllib2
import os
import re
import csv
from bs4 import BeautifulSoup

useragent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17'

def main():
    # lib-talkingpointsmemo.py
    archive = 'http://talkingpointsmemo.com/archive.php'    
    getweeklinks(archive)

def getweeklinks(archivelink):
    print 'something'
    urls = []
    request = urllib2.Request(archivelink, headers={'User-agent': useragent})
    webpage = urllib2.urlopen(request).read()   
    soup = BeautifulSoup(webpage)
    anchors = soup('a') 
    print anchors
    for a in anchors:
        print a['href']

if __name__ == '__main__' : main()

and the output :

something
[]

Whats wrong? I am using Ubuntu 12.04.1 LTS

  • 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-18T05:52:29+00:00Added an answer on June 18, 2026 at 5:52 am

    hmmm… nothing is wrong with your script, it is working fine for me on Ubuntu, except for I’m using: Ubuntu 10.04.2 LTS, and Python 2.6.5

    shot in the dark, but maybe try…

    soup = BeautifulSoup(webpage,"html.parser")
    

    …to make sure your using the same parser between your windows and ubuntu tests. You may also want to try some of the other parser options

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

Sidebar

Related Questions

I have this script, running on a links list: $('li#linkcat-25 a').bind('click', function (e) {
I am currently developing on an advertising system, which have been running just fine
I'm running a Python script as a Hadoop streaming job, but this post is
I've got a PHP script which I'm running from a command line (windows) that
I have a PHP script with infinite loop. I need this script running forever.
I have a Python script that is running a few ls commands. This script
I got this jQuery pre-loading script running on a index.html page loading about 10Mb
This MySQL script installs multiple triggers. It works on one machine running MySQL 5.0.51b-community.
I tried running a python script: print Hello, World! And I get this error:
This seems redundant, running perl from a Perl script itself. my $Pref = &*())(*&^%$#@!;

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.