New to Python, Help to get script working?

M

Mark

Hey guys, I found this website that has a script in order to increase numbers to a live viewing stream. Being new to python, I keep running into problems trying to get it to work.

The original site is here, as he talks about how it works. It is the top article.

http://www.ericzhang.me/

I have successfully installed python 3.3 for windows, pip and livestreamer that is needed for it to work. They are in my scripts folder. I either do not understand the script or it no longer works. It is more than likely my error. I get errors on line 19 and cant get it to work at all.

The included code is located here

https://gist.github.com/Xeroday/6468146/raw/1b7fb468551a4ba5b73ea3c0b7bc47591c3a8c51/Twitch.py


If anybody could provide some incite on how to get it to work, how the variables work, and such, I would be so grateful!

Mark
 
S

Steven D'Aprano

Hey guys, I found this website that has a script in order to increase
numbers to a live viewing stream. Being new to python, I keep running
into problems trying to get it to work.

The original site is here, as he talks about how it works. It is the top
article.

http://www.ericzhang.me/

I have successfully installed python 3.3 for windows,

Great! But what version of Python is that script written for?

[...]
I get errors on line 19 and cant get it to work at all.

Errors plural? Multiple errors on one line? That's unusual.

Please copy and paste (don't summarise or re-type from memory) the entire
traceback showing the full error you get. That is, copy and paste
*everything* from the first line

Traceback (most recent call last)


all the way to the end of the error message.
 
C

Chris Angelico

I have successfully installed python 3.3 for windows, pip and livestreamer that is needed for it to work.

What I'm seeing in that script suggests that it actually needs Python
2.7, not 3.3. The best approach would be to make it work with Python
3, but if you can't do that, try installing Python 2.

But more generally, when you get errors, it helps *hugely* to copy and
paste the error - don't just say "on line 19", and leave us to guess
what error you're getting :)

ChrisA
 
D

Denis McMahon

I have successfully installed python 3.3 for windows, pip and
livestreamer that is needed for it to work. They are in my scripts
folder. I either do not understand the script or it no longer works. It
is more than likely my error. I get errors on line 19 and cant get it to
work at all.

If you're getting the "not enough goats and chickens sacrificed error",
sacrifice more goats and chickens.

(Hint - it would help if you told us what the error was, and displayed at
least the line the error occurs on and the preceding 10 lines or so)
 
M

Mark

Thanks for the replies, I was hoping that one of you guys could actually try it for me, as it might be easier to correct? In the meantime i will install 2.7 instead of 3.3 and give it a try.

Once again, i have very little experience in this, which is why i am looking for help :) I am more worried about getting it to work then knowing whats wrong, but it could also be helpful haha

Thanks

Mark
 
M

Mark

Thanks for the replies, I was hoping that one of you guys could actually try it for me, as it might be easier to correct? In the meantime i will install 2.7 instead of 3.3 and give it a try.



Once again, i have very little experience in this, which is why i am looking for help :) I am more worried about getting it to work then knowing whats wrong, but it could also be helpful haha



Thanks



Mark

I originally get an indent error on line 19, i delete the indent and i get

***'return outside function (Twitch.py, line 19)

Thats where i am at. This is on version 2.7

If anybody could correct this for me or provide some incite. i would be very grateful. If any of you would be available for some sort of chat to fix it, I would also love to do something like that.

Thanks again

Mark
 
C

Chris Angelico

I originally get an indent error on line 19, i delete the indent and i get

***'return outside function (Twitch.py, line 19)

Good point, someone's made a mistake in that file. What you need to do
is match the "output = ..." line and the "return ..." line underneath
it. For consistency with the rest of the file, indent the "output"
line to match the other. That should make it work.

ChrisA
 
S

Steven D'Aprano

I originally get an indent error on line 19, i delete the indent and i
get

***'return outside function (Twitch.py, line 19)

Thats where i am at. This is on version 2.7


Remember the bit where we asked you to copy and paste the entire error
message, starting from the Traceback line? This is *important*, please do
not ignore it. If you're going to ask for help from experts, pay
attention to what the experts tell you.

At this point, I recommend you download the script again, since you've
been making modifications to it and have probably introduced your own
errors. Better to start again with a fresh copy in a known good state,
rather than one that you've been making arbitrary changes to:

Step 1: replace the modified version of the script with a known good copy.

Step 2: try running that script using the correct version of Python.

Step 3: if it fails in some way, copy and paste the entire traceback. It
may be that you're using it wrongly.
 
C

Chris Angelico

Step 1: replace the modified version of the script with a known good copy.

Actually, this might be where the problem is, unfortunately. Not the
OP's fault at all. I went and looked at the post linked to, and it has
buggy indentation. (Quite possibly indicates that the author has
two-space tabs, and didn't notice a bug slipping in. I dunno.)

Along the way, though, I learned that the script in question is
entirely for generating fake twitch.tv viewers so as to get your
stream highlighted fraudulently, so I'm rather less inclined to help.
Got a legitimate use for this, or are you just trying to cheat your
way to fame?

ChrisA
 
M

Mark

Actually, this might be where the problem is, unfortunately. Not the

OP's fault at all. I went and looked at the post linked to, and it has

buggy indentation. (Quite possibly indicates that the author has

two-space tabs, and didn't notice a bug slipping in. I dunno.)



Along the way, though, I learned that the script in question is

entirely for generating fake twitch.tv viewers so as to get your

stream highlighted fraudulently, so I'm rather less inclined to help.

Got a legitimate use for this, or are you just trying to cheat your

way to fame?



ChrisA

Thanks for the reply, the answer is yes and no, i already have about 2400 followers and half mil views, i just wanted to see if i could get it to work.

So after taking everybody's advice, fixed the indentation as mentioned by the expert above. :) After, this is what i came up with

Traceback (most recent call last):
File "C:\Python27\Scripts\Twitch.py", line 9, in <module>
numberOfViewers = int(sys.argv[1])
IndexError: list index out of range

Is this where i would plug in the variables to make it work? I'm not quite sure about how you would plug in those numbers
 
M

Mark

Actually, this might be where the problem is, unfortunately. Not the

OP's fault at all. I went and looked at the post linked to, and it has

buggy indentation. (Quite possibly indicates that the author has

two-space tabs, and didn't notice a bug slipping in. I dunno.)



Along the way, though, I learned that the script in question is

entirely for generating fake twitch.tv viewers so as to get your

stream highlighted fraudulently, so I'm rather less inclined to help.

Got a legitimate use for this, or are you just trying to cheat your

way to fame?



ChrisA



Thanks for the reply, the answer is yes and no, i already have about 2400 followers and half mil views, i just wanted to see if i could get it to work.



So after taking everybody's advice, fixed the indentation as mentioned by the expert above. :) After, this is what i came up with



Traceback (most recent call last):

File "C:\Python27\Scripts\Twitch.py", line 9, in <module>

numberOfViewers = int(sys.argv[1])

IndexError: list index out of range



Is this where i would plug in the variables to make it work? I'm not quite sure about how you would plug in those numbers

okay so i kinda get it now, running it in cmd, i use the following command -
python twitch.py 10 10. I am running it within the scripts directory.

I get the following error in cmd:

Syntax Error: invalid syntaxFile "<stdin> line 1
python twitch.py 10 10
 
C

Chris Angelico

Syntax Error: invalid syntax
File "<stdin> line 1
python twitch.py 10 10

You're trying to run that from the interactive Python prompt. Run it
from the system - exit Python and run just this script.

ChrisA
 
M

Mark

Step 1: replace the modified version of the script with a known good copy.
Actually, this might be where the problem is, unfortunately. Not the
OP's fault at all. I went and looked at the post linked to, and it has
buggy indentation. (Quite possibly indicates that the author has
two-space tabs, and didn't notice a bug slipping in. I dunno.)
Along the way, though, I learned that the script in question is
entirely for generating fake twitch.tv viewers so as to get your
stream highlighted fraudulently, so I'm rather less inclined to help.
Got a legitimate use for this, or are you just trying to cheat your
way to fame?
Thanks for the reply, the answer is yes and no, i already have about 2400 followers and half mil views, i just wanted to see if i could get it to work.
So after taking everybody's advice, fixed the indentation as mentioned by the expert above. :) After, this is what i came up with
Traceback (most recent call last):
File "C:\Python27\Scripts\Twitch.py", line 9, in <module>
numberOfViewers = int(sys.argv[1])
IndexError: list index out of range
Is this where i would plug in the variables to make it work? I'm not quite sure about how you would plug in those numbers



okay so i kinda get it now, running it in cmd, i use the following command -

python twitch.py 10 10. I am running it within the scripts directory.



I get the following error in cmd:



Syntax Error: invalid syntax

File "<stdin> line 1

python twitch.py 10 10

is there a more effecient way of doing this? I just hold shift and right click to run cmd from the folder,

File is located in C:\Python27\Scripts
 
M

Mark

Step 1: replace the modified version of the script with a known good copy.
Actually, this might be where the problem is, unfortunately. Not the
OP's fault at all. I went and looked at the post linked to, and it has
buggy indentation. (Quite possibly indicates that the author has
two-space tabs, and didn't notice a bug slipping in. I dunno.)
Along the way, though, I learned that the script in question is
entirely for generating fake twitch.tv viewers so as to get your
stream highlighted fraudulently, so I'm rather less inclined to help.
Got a legitimate use for this, or are you just trying to cheat your
way to fame?
Thanks for the reply, the answer is yes and no, i already have about 2400 followers and half mil views, i just wanted to see if i could get it to work.
So after taking everybody's advice, fixed the indentation as mentioned by the expert above. :) After, this is what i came up with
Traceback (most recent call last):
File "C:\Python27\Scripts\Twitch.py", line 9, in <module>
numberOfViewers = int(sys.argv[1])
IndexError: list index out of range
Is this where i would plug in the variables to make it work? I'm not quite sure about how you would plug in those numbers
okay so i kinda get it now, running it in cmd, i use the following command -
python twitch.py 10 10. I am running it within the scripts directory.
I get the following error in cmd:
Syntax Error: invalid syntax
python twitch.py 10 10
File "<stdin> line 1
python twitch.py 10 10



is there a more effecient way of doing this? I just hold shift and right click to run cmd from the folder,



File is located in C:\Python27\Scripts

It was my understanding that you need to meet the arguments by running the in cmd with the numbers after? I am sorry to show my true noobyness and really appreciate the help.
 
M

Mark

Step 1: replace the modified version of the script with a known good copy.
Actually, this might be where the problem is, unfortunately. Not the
OP's fault at all. I went and looked at the post linked to, and it has
buggy indentation. (Quite possibly indicates that the author has
two-space tabs, and didn't notice a bug slipping in. I dunno.)
Along the way, though, I learned that the script in question is
entirely for generating fake twitch.tv viewers so as to get your
stream highlighted fraudulently, so I'm rather less inclined to help.
Got a legitimate use for this, or are you just trying to cheat your
way to fame?
Thanks for the reply, the answer is yes and no, i already have about 2400 followers and half mil views, i just wanted to see if i could get it to work.
So after taking everybody's advice, fixed the indentation as mentioned by the expert above. :) After, this is what i came up with
Traceback (most recent call last):
File "C:\Python27\Scripts\Twitch.py", line 9, in <module>
numberOfViewers = int(sys.argv[1])
IndexError: list index out of range
Is this where i would plug in the variables to make it work? I'm not quite sure about how you would plug in those numbers
okay so i kinda get it now, running it in cmd, i use the following command -
python twitch.py 10 10. I am running it within the scripts directory.
I get the following error in cmd:
Syntax Error: invalid syntax
python twitch.py 10 10
File "<stdin> line 1
python twitch.py 10 10
is there a more effecient way of doing this? I just hold shift and right click to run cmd from the folder,
File is located in C:\Python27\Scripts



It was my understanding that you need to meet the arguments by running the in cmd with the numbers after? I am sorry to show my true noobyness and really appreciate the help.

Here is a link to the actual file, maybe you can look at it and see if it looks good? Should i change anything else in the file to make it work theoretically or is it all done when you run it?

http://www.mediafire.com/view/3m10s9rwvatxd96/twitch.py
 
M

Mark

Step 1: replace the modified version of the script with a known good copy.
Actually, this might be where the problem is, unfortunately. Not the
OP's fault at all. I went and looked at the post linked to, and it has
buggy indentation. (Quite possibly indicates that the author has
two-space tabs, and didn't notice a bug slipping in. I dunno.)
Along the way, though, I learned that the script in question is
entirely for generating fake twitch.tv viewers so as to get your
stream highlighted fraudulently, so I'm rather less inclined to help.
Got a legitimate use for this, or are you just trying to cheat your
way to fame?
Thanks for the reply, the answer is yes and no, i already have about 2400 followers and half mil views, i just wanted to see if i could get it to work.
So after taking everybody's advice, fixed the indentation as mentioned by the expert above. :) After, this is what i came up with
Traceback (most recent call last):
File "C:\Python27\Scripts\Twitch.py", line 9, in <module>
numberOfViewers = int(sys.argv[1])
IndexError: list index out of range
Is this where i would plug in the variables to make it work? I'm not quite sure about how you would plug in those numbers
okay so i kinda get it now, running it in cmd, i use the following command -
python twitch.py 10 10. I am running it within the scripts directory.
I get the following error in cmd:
Syntax Error: invalid syntax
python twitch.py 10 10
File "<stdin> line 1
python twitch.py 10 10
is there a more effecient way of doing this? I just hold shift and right click to run cmd from the folder,
File is located in C:\Python27\Scripts
It was my understanding that you need to meet the arguments by running the in cmd with the numbers after? I am sorry to show my true noobyness and really appreciate the help.



Here is a link to the actual file, maybe you can look at it and see if it looks good? Should i change anything else in the file to make it work theoretically or is it all done when you run it?



http://www.mediafire.com/view/3m10s9rwvatxd96/twitch.py

If i just try to double click the script, i get an index error, i can barely see the window it disappears so fast, but thats what I see.
 
F

Frank Millman

Mark said:
On Monday, December 16, 2013 2:55:23 AM UTC-5, Mark wrote:

If i just try to double click the script, i get an index error, i can
barely see the window it disappears so fast, but thats what I see.

I haven't really been following this thread, but I assume you are on
Windows.

If so, you can open a Command Prompt from All Programs/Accessories, 'cd' to
the folder containing your script, and type in the script name.

It will start, crash, and display the error, but the window will stay open,
so you will be able to read the full traceback.

Normally the traceback provides enough clues that you can figure out for
yourself what the problem is. But if you still cannot solve it, copy/paste
the entire traceback and send it here. The chances are that someone can
help.

BTW, did you notice that I removed the bulk of your original message, and
left behind just enough to provide a context for your question and for my
reply? This is good etiquette, and others will appreciate your doing the
same.

Frank Millman
 
M

Mark Lawrence

On 16/12/2013 08:02, Mark wrote:

The record for double spaced google crap, congratulations. Mind you,
it's a great new game this, Spot the Text, much better than I Spy!!!
Step 1: replace the modified version of the script with a known good copy.
Actually, this might be where the problem is, unfortunately. Not the
OP's fault at all. I went and looked at the post linked to, and it has
buggy indentation. (Quite possibly indicates that the author has
two-space tabs, and didn't notice a bug slipping in. I dunno.)
Along the way, though, I learned that the script in question is
entirely for generating fake twitch.tv viewers so as to get your
stream highlighted fraudulently, so I'm rather less inclined to help.
Got a legitimate use for this, or are you just trying to cheat your
way to fame?

Thanks for the reply, the answer is yes and no, i already have about 2400 followers and half mil views, i just wanted to see if i could get it to work.
So after taking everybody's advice, fixed the indentation as mentioned by the expert above. :) After, this is what i came up with
Traceback (most recent call last):
File "C:\Python27\Scripts\Twitch.py", line 9, in <module>
numberOfViewers = int(sys.argv[1])
IndexError: list index out of range
Is this where i would plug in the variables to make it work? I'm not quite sure about how you would plug in those numbers
okay so i kinda get it now, running it in cmd, i use the following command -
python twitch.py 10 10. I am running it within the scripts directory.
I get the following error in cmd:
Syntax Error: invalid syntax
python twitch.py 10 10
File "<stdin> line 1
python twitch.py 10 10
is there a more effecient way of doing this? I just hold shift and right click to run cmd from the folder,
File is located in C:\Python27\Scripts
It was my understanding that you need to meet the arguments by running the in cmd with the numbers after? I am sorry to show my true noobyness and really appreciate the help.



Here is a link to the actual file, maybe you can look at it and see if it looks good? Should i change anything else in the file to make it work theoretically or is it all done when you run it?



http://www.mediafire.com/view/3m10s9rwvatxd96/twitch.py

If i just try to double click the script, i get an index error, i can barely see the window it disappears so fast, but thats what I see.
 
N

Ned Batchelder

If i just try to double click the script, i get an index error, i can barely see the window it disappears so fast, but thats what I see.

If you're going to participate in this forum, you'll get better help
from people if you use the medium well.

1) Sending 4 message in a row, within 15 minutes, each replying to the
other, is not a good way to use a forum like this. Get your thoughts in
order and send one message.

2) While I am normally quite tolerant of the double-spacing Google
Groups insists on, your messages are taking it to absurd extremes. Take
a look at your last message:
https://mail.python.org/pipermail/python-list/2013-December/662678.html
True, it's kind of beautiful in an abstract way, and is an interesting
demonstration of certain binary behaviors, but it is not a good way to
participate here.

Of course, the messages you post are your choice, but you should
consider the effect they have on the people you are hoping to get help from.
 
M

Mark

I am sorry if the way I posted messages was incorrect. Like I said, I am new to google groups and python quite a bit but i am trying to do things correctly by you guys. The errors that I am getting were not necessarily posting traceback messages.

In those messages I posted my last bit of confusion, how to properly run the program while meeting the arguments. Thanks Frank for giving me a little hint at that.

Now in that directory in cmd, i type in python twitch.py 10 10. When i do this I get "thread error" posting infinitely down my stream. So it looks like the program is actually running now, just some im possibly missing? Once again I do have pip and livestreamer installed and the exact py file i haveis located here:
http://www.mediafire.com/view/3m10s9rwvatxd96/twitch.py

Once again thanks for help,

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top