Python Introduction - Page 2
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Python Introduction

  1. #11
    Super Moderator
    Know-it-All Master Beaver

    Join Date
    Jan 2003
    Posts
    3,914
    I think it's a fairly safe bet that under DOS, python does not support sockets.
    No doubt you are right. However I use DOS Edit on my XP install on almost a daily basis. All of the examples on this tut. were written in Edit. I love it as a program. Edit <filename> save exit python <filename>. It's nice and quick.

  2. #12
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    i agree with you HT about edit i like the way it holds the indent when you make a new line...but how does that relate to sockets??

    does python have a DOS version? i know perl does.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  3. #13
    Senior Member Ouroboros's Avatar
    Join Date
    Nov 2001
    Location
    Superior, WI USA
    Posts
    628
    Thanks...now I have something to mull over for another few weeks...

    Honestly, thanks for introducing Python...it actually reminds me of BASIC, with obvious advancements, so it should be fun to fool around with.

    Ouroboros
    "entia non sunt multiplicanda praeter necessitatem"

    "entities should not be multiplied beyond necessity."

    -Occam's Razor


  4. #14
    Super Moderator
    Know-it-All Master Beaver

    Join Date
    Jan 2003
    Posts
    3,914
    Originally posted here by Tedob1
    i agree with you HT about edit i like the way it holds the indent when you make a new line...but how does that relate to sockets??

    does python have a DOS version? i know perl does.
    I'm assuming the sockets were mentioned because DOS doesn't have native network support, so socket calls would be pretty much useless. As for a DOS version of python, not that I have seen...

  5. #15
    Junior Member
    Join Date
    Jan 2005
    Posts
    1
    File "add.py", line 1
    from socket import *
    ^
    SyntaxError: invalid syntax


    why is the error

  6. #16
    Senior Member
    Join Date
    Mar 2005
    Posts
    400

    Exclamation

    # My first -ever- Python program, created after seeing an introductory sample of looping.
    # Created May 26, 2003, Memorial Day
    # NOTE: My first hands-on experience with Python, totaling a whopping 10 minutes of basic
    # tutorial experience, immediately followed by 4 hours of perfecting the tutorial example
    # okay, so the truth is I can't seem to NOT veer from trying to be more creative
    # when I should be following along with a very simple introductory Python tutorial.
    # Look at it this way, maybe I'm gifted in the programming field, I liked it.
    #
    # Here is the example I should of been following: (the code without the "#" is the 4 hour job.
    #for i in range(0, 10) :
    # if i % 2 == 0 :
    # print i, 'is an even number'
    # else :
    # print i, 'is an odd number'

    for i in range (0,25) :
    if i == 0 :
    print i, '(zero) is not a divisable number'
    elif i % 3 == 0 :
    print i, 'is evenly divided by three'
    if i == 1 :
    print i, '(One) is not evenly divisable by three'
    elif i % 3 == 1 :
    print i, 'is divisable by three with a remainder of', i % 3
    if i == 2 :
    print i, '(Two) is not evenly divisable by three'
    elif i % 3 == 2 :
    print i, 'is divisable by three with a remainder of', i % 3


    Python is addictive for me.
    ZT3000
    Beta tester of "0"s and "1"s"

  7. #17
    Super Moderator
    Know-it-All Master Beaver

    Join Date
    Jan 2003
    Posts
    3,914
    Originally posted here by backspace
    File "add.py", line 1
    from socket import *
    ^
    SyntaxError: invalid syntax


    why is the error
    Hey Hey,

    I'm surprised to see this thread pulled up after so long... What version of python were you using and which operating system was it for... there may be some vital differences among the way you import files, depending on the version used. These examples were working with both ActivePython for Win32 and The Linux version, however depending on which actual version you have it may explain it.

    Peace,
    HT
    IT Blog: .:Computer Defense:.
    PnCHd (Pronounced Pinched): Acronym - Point 'n Click Hacked. As in: "That website was pinched" or "The skiddie pinched my computer because I forgot to patch".

  8. #18
    AO Ancient: Team Leader
    Join Date
    Oct 2002
    Posts
    5,197
    The reason is because the file socket.py is not in the current directory and you don't have the environment variable PYTHONPATH set to point to the location of the socket.py file.

    No, I'm not a genius. This thread being resurrected reminded me that I wanted to look into Python to see what it could do and I had the same issue.... But I RTFM....
    Don\'t SYN us.... We\'ll SYN you.....
    \"A nation that draws too broad a difference between its scholars and its warriors will have its thinking done by cowards, and its fighting done by fools.\" - Thucydides

  9. #19
    Banned
    Join Date
    Sep 2005
    Posts
    4

    Question Sounds Like...

    It Kinda sounds like your reading it from the book "Learning Python" Thats just my opinion but, your pretty good at the tutorials... I have a question, I keep getting negative anti points. Why, I keep going in newbie forums but i still get negative anti points...?

  10. #20
    I'd rather be fishing DjM's Avatar
    Join Date
    Aug 2001
    Location
    The Great White North
    Posts
    1,867

    Re: Sounds Like...

    Originally posted here by PrOxY_LoCaToR
    It Kinda sounds like your reading it from the book "Learning Python" Thats just my opinion but, your pretty good at the tutorials... I have a question, I keep getting negative anti points. Why, I keep going in newbie forums but i still get negative anti points...?
    Well replying to old threads is a pretty good way to get negative points, asking about negative points is another way to increase the amount of reds you get.

    Just a hint, check the comments on the assignment, they might give you a clue as to why your getting hit.

    Cheers:
    DjM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides