Gay errors that don't even make sense - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Gay errors that don't even make sense

Lazer_BurnLazer_Burn Posts: 6Member
[b][red]This message was edited by Lazer_Burn at 2005-9-3 9:47:48[/red][/b][hr]
[b][red]This message was edited by Lazer_Burn at 2005-9-2 22:40:56[/red][/b][hr]
Hi guys,

I'm gonna skip the background for now cause i;m really frustrated and i can't see straight.

Ok I know the basic of python, and a few other languages. I'm not a total n00b.

Sooo today I decided I'd really crack down and work through my python book. I had done a math problem the other day, it read as follows;

A vending machine will give you a can of coke for 50c, it take quarters, nickels and dimes. I thought i could use this as a basis for a program, you know for purpose purposes.

Ok so i sit down at my comp start up my 2.4 IDE and punch out the following code;

import math # all functions defined here
def newLine(): # creates a new line
print
def Xline(x): # creates x new lines (mechanics: x changes every time (x-1) is run)
if x > 0:
print
Xline(x-1)
print "This Program is designed to list he possible combinations for a user defined result"
print "Such as what are the combinations to make 50c out of quarters dimes and nickels"
Xline(2)
print "Input up to four values for the devices that will make up the combination"
print "They must be whole number values, if you have less than four devices"
print "Put a 0 for that input"
a = raw_input ("device a")
b = raw_input ("device b")
c = raw_input ("device c")
d = raw_input ("device d")
Xline(2)
print "Now input combination total"
z = raw_input ("combination total")
Xline(2)
print "Now the program should spit some answers out for you"

pretty simple stuff, just a little refresher. So i decide to save and run and i get these errors;

the first error window pops up saying:

IDLE Subprocess Error
Socker Error: Connection refused

then the second windo pops up and says;

Subprocess startup Error
IDLE's subprocess didn't make a connection, either IDLE can;t start a subprocess or personal firewall software is blocking the connection.

Guess how I'm feelin now....
I look over the code again, looks good to me. It then occurs to me that maybe the commands changed a bit. I learned the basics back in 2.1 and 2.2.

So heres my questions;

What I do wrong?

Anyone know how to get user input into a programmer defined function ( like that Xline(x))?

PS I'm running windows xp pent 4, so gay i'm gettin linux soon....

*The indentations in the code didn't come out for some reason when i cut and pasted*




Comments

  • Lazer_BurnLazer_Burn Posts: 6Member
    : [b][red]This message was edited by Lazer_Burn at 2005-9-3 9:47:48[/red][/b][hr]
    : [b][red]This message was edited by Lazer_Burn at 2005-9-2 22:40:56[/red][/b][hr]
    : Hi guys,
    :
    : I'm gonna skip the background for now cause i;m really frustrated and i can't see straight.
    :
    : Ok I know the basic of python, and a few other languages. I'm not a total n00b.
    :
    : Sooo today I decided I'd really crack down and work through my python book. I had done a math problem the other day, it read as follows;
    :
    : A vending machine will give you a can of coke for 50c, it take quarters, nickels and dimes. I thought i could use this as a basis for a program, you know for purpose purposes.
    :
    : Ok so i sit down at my comp start up my 2.4 IDE and punch out the following code;
    :
    : import math # all functions defined here
    : def newLine(): # creates a new line
    : print
    : def Xline(x): # creates x new lines (mechanics: x changes every time (x-1) is run)
    : if x > 0:
    : print
    : Xline(x-1)
    : print "This Program is designed to list he possible combinations for a user defined result"
    : print "Such as what are the combinations to make 50c out of quarters dimes and nickels"
    : Xline(2)
    : print "Input up to four values for the devices that will make up the combination"
    : print "They must be whole number values, if you have less than four devices"
    : print "Put a 0 for that input"
    : a = raw_input ("device a")
    : b = raw_input ("device b")
    : c = raw_input ("device c")
    : d = raw_input ("device d")
    : Xline(2)
    : print "Now input combination total"
    : z = raw_input ("combination total")
    : Xline(2)
    : print "Now the program should spit some answers out for you"
    :
    : pretty simple stuff, just a little refresher. So i decide to save and run and i get these errors;
    :
    : the first error window pops up saying:
    :
    : IDLE Subprocess Error
    : Socker Error: Connection refused
    :
    : then the second windo pops up and says;
    :
    : Subprocess startup Error
    : IDLE's subprocess didn't make a connection, either IDLE can;t start a subprocess or personal firewall software is blocking the connection.
    :
    : Guess how I'm feelin now....
    : I look over the code again, looks good to me. It then occurs to me that maybe the commands changed a bit. I learned the basics back in 2.1 and 2.2.
    :
    : So heres my questions;
    :
    : What I do wrong?
    :
    : Anyone know how to get user input into a programmer defined function ( like that Xline(x))?
    :
    : PS I'm running windows xp pent 4, so gay i'm gettin linux soon....
    :
    : *The indentations in the code didn't come out for some reason when i cut and pasted*
    :
    :
    :
    :
    :


    Um I fixed some stuff but I'm still having alot of probs that don't make sense. Here is the revised code;

    import math # all functions defined here
    def newLine(): # creates a new line
    print
    def Xline(x): # creates x new lines (mechanics: x changes every time (x-1) is run)
    if x > 0:
    print
    Xline(x-1)
    print "This Program is designed to list he possible combinations for a user defined result"
    print "Such as what are the combinations to make 50c out of quarters dimes and nickels"
    Xline(2)
    print "Input up to four values for the devices that will make up the combination"
    print "They must be whole number values, if you have less than four devices"
    print "Put a 0 for that input"
    a = raw_input("device a ")
    b = raw_input("device b ")
    c = raw_input("device c ")
    d = raw_input("device d ")
    Xline(2)
    print "Now input combination total"
    z = raw_input("combination total ")
    Xline(2)
    print "Now the program should spit some answers out for you"

    But now when i try to do an if statement for the "variable a"

    if a == z:
    print "sumthin"
    else:
    print "sumthin else"

    the IDE starts spitting more errors. I had planned to make a chain of if statments, but it wont let me use raw_input data variables *GOSH*.

  • DrostDrost Posts: 24Member
    : : Hi guys,
    : : Ok so i sit down at my comp start up my 2.4 IDE and punch out the following code;

    IDLE's main process uses a separate thread to run your scripts and it utilises a connection to 127.0.0.1 (localhost) to control it. Your firewall seems to block it silently (which is for my taste a badly designed software). Either allow this connection, or leave IDLE. The interactive python shell/prompt gives you the same amount of help to write one-shot scripts without the hassles, or get used to writing real scripts in any texteditor.

    [code]
    def Xline(x): # creates x new lines (mechanics: x changes every time (x-1) is run)
    if x > 0:
    print
    Xline(x-1)
    [/code]
    Now that's something that hurts...
    A recursive function to have a linebreak n times??? Way too complicated!
    How about this?
    [code]
    def Xline(x):
    print "
    " * (x-1)
    [/code]

    : But now when i try to do an if statement for the "variable a"
    :
    : if a == z:
    : print "sumthin"
    : else:
    : print "sumthin else"
    :
    : the IDE starts spitting more errors. I had planned to make a chain of if statments, but it wont let me use raw_input data variables *GOSH*.

    More errors? Specifically?

    Drost
  • infidelinfidel Posts: 2,900Member
    See Drost's post for comments regarding the IDLE socket stuff. I highly recommend the PythonWin IDE over IDLE if you're on a Windows box.

    : : *The indentations in the code didn't come out for some reason when i cut and pasted*

    This board's software has it's own special markup tags to keep fixed-width formatting: [leftbr]code[rightbr] and [leftbr]/code[rightbr]

    : a = raw_input("device a ")
    : b = raw_input("device b ")
    : c = raw_input("device c ")
    : d = raw_input("device d ")
    : Xline(2)
    : print "Now input combination total"
    : z = raw_input("combination total ")
    : Xline(2)
    : print "Now the program should spit some answers out for you"
    :
    : But now when i try to do an if statement for the "variable a"
    :
    : if a == z:
    : print "sumthin"
    : else:
    : print "sumthin else"
    :
    : the IDE starts spitting more errors. I had planned to make a chain of if statments, but it wont let me use raw_input data variables *GOSH*.

    What error do you get?


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • Lazer_BurnLazer_Burn Posts: 6Member
    : See Drost's post for comments regarding the IDLE socket stuff. I highly recommend the PythonWin IDE over IDLE if you're on a Windows box.
    :
    : : : *The indentations in the code didn't come out for some reason when i cut and pasted*
    :
    : This board's software has it's own special markup tags to keep fixed-width formatting: [leftbr]code[rightbr] and [leftbr]/code[rightbr]
    :
    : : a = raw_input("device a ")
    : : b = raw_input("device b ")
    : : c = raw_input("device c ")
    : : d = raw_input("device d ")
    : : Xline(2)
    : : print "Now input combination total"
    : : z = raw_input("combination total ")
    : : Xline(2)
    : : print "Now the program should spit some answers out for you"
    : :
    : : But now when i try to do an if statement for the "variable a"
    : :
    : : if a == z:
    : : print "sumthin"
    : : else:
    : : print "sumthin else"
    : :
    : : the IDE starts spitting more errors. I had planned to make a chain of if statments, but it wont let me use raw_input data variables *GOSH*.
    :
    : What error do you get?
    :
    :
    : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    :
    : [code]
    : $ select * from users where clue > 0
    : no rows returned
    : [/code]
    :
    :

    Hey Thanks Infidel and Drost for posting! I got it all figured out now..... :-)

    print "Hello World"

Sign In or Register to comment.