Israel's Profile User Rating: -----

Reputation: 7 Worker
Group:
Authors
Active Posts:
824 (0.2 per day)
Joined:
22-November 04
Profile Views:
12,384
Last Active:
User is offline Sep 19 2015 03:27 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Mitsubishi
Dream Kudos:
200

Latest Visitors

Icon   Israel In /dev/null no one can hear you scream...

Posts I've Made

  1. In Topic: Trouble Passing Command-Line Arguement

    Posted 19 Sep 2015

    Omg... That just made me feel stupid:

    ./scrape.py http://google.com
    http://www.google.com/imghp?hl=en&tab=wi
    http://maps.google.com/maps?hl=en&tab=wl
    https://play.google.com/?hl=en&tab=w8
    http://www.youtube.com/?tab=w1
    http://news.google.com/nwshp?hl=en&tab=wn
    https://mail.google.com/mail/?tab=wm
    https://drive.google.com/?tab=wo
    http://www.google.com/intl/en/options/
    http://www.google.com/history/optout?hl=en
    http://google.com/preferences?hl=en
    https://accounts.google.com/ServiceLogin?hl=en&continue=http://www.google.com/
    http://google.com/chrome/browser/?hl=en&brand=CHNG&utm_source=en-hpp&utm_medium=hpp&utm_campaign=en
    http://google.com/advanced_search?hl=en&authuser=0
    http://google.com/language_tools?hl=en&authuser=0
    http://google.com/intl/en/ads/
    http://google.com/services/
    https://plus.google.com/116899029375914044550
    http://google.com/intl/en/about.html
    http://google.com/intl/en/policies/privacy/
    http://google.com/intl/en/policies/terms/
    
    Nuber of total URLs: 20
    


    Switching from night to day shift does not help my logic capabilities. Thank you for your patience.
  2. In Topic: Trouble Passing Command-Line Arguement

    Posted 19 Sep 2015

    Quote

    argv is a list (what made you think it was a single value?)


    I didn't know it was an actual list, but that makes sense. I changed this line to the following :

    httpResponse = urllib.urlopen(sys.argv[1])
    


    Now I'm suddenly being asked for a file or directory?

    $ ./scrape.py google.com
    Traceback (most recent call last):
      File "./scrape.py", line 18, in <module>
        httpResponse = urllib.urlopen(sys.argv[1])
      File "/usr/lib/python2.7/urllib.py", line 86, in urlopen
        return opener.open(url)
      File "/usr/lib/python2.7/urllib.py", line 207, in open
        return getattr(self, name)(url)
      File "/usr/lib/python2.7/urllib.py", line 462, in open_file
        return self.open_local_file(url)
      File "/usr/lib/python2.7/urllib.py", line 476, in open_local_file
        raise IOError(e.errno, e.strerror, e.filename)
    IOError: [Errno 2] No such file or directory: 'google.com'
    


    I tried str(sys.argv[1]) with the same results. Maybe the library requires a file for this? Or maybe I'm still doing it wrong :P

    Thanks for the suggestion!
  3. In Topic: Regex Causing "list index out of range" Error

    Posted 28 Feb 2014

    That dawned on me while I was away for my computer a couple hours.

    Good call though. Derp!
  4. In Topic: Regex Causing "list index out of range" Error

    Posted 28 Feb 2014

    I see what you mean. I took out the [^127.0.0.1] like so:

    #!/usr/bin/python
    
    import re
    import subprocess
    from subprocess import Popen, PIPE
    
    pattern = re.compile(r'inet.*\d+\.\d+\.\d+\.\d+')
    
    p1 = Popen(["/sbin/ifconfig"], stdout=subprocess.PIPE)
    
    output = p1.communicate()[0]
    result = re.findall(pattern, output)
    
    print result[0]
    


    And a line with 127.0.0.1 is all I get:

    # ./test.py 
    inet addr:127.0.0.1  Mask:255.0.0.0
    


    Would you happen to know why its finding 127.0.0.1, but missing 10.0.0.139 listed on my other interface?

    wlan2     Link encap:Ethernet  HWaddr 00:1f:1f:7e:a3:de  
              inet addr:10.0.0.139  Bcast:10.0.0.255  Mask:255.255.255.0
              inet6 addr: fe80::21f:1fff:fe7e:a3de/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:19712 errors:0 dropped:0 overruns:0 frame:0
              TX packets:17179 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:14323745 (13.6 MiB)  TX bytes:3351821 (3.1 MiB)
    


    Thanks for getting me this far.
  5. In Topic: Code adding a new line when it shouldn't...

    Posted 22 Feb 2014

    Nice! Guess I have a lot more to learn about debugging with Python. The "from array import *" was something I found searching for arrays, but it seems to work fine without it. Thank you both!

My Information

Member Title:
D.I.C Addict
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Hell
Years Programming:
8
Programming Languages:
C, Python, Perl, Ruby, Bash HTML, CSS, PHP, MySQL

Contact Information

E-mail:
Click here to e-mail me

Comments

Israel has no profile comments yet. Why not say hello?