Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS error #64

Open
PixelOrange opened this issue Apr 20, 2014 · 9 comments
Open

CSS error #64

PixelOrange opened this issue Apr 20, 2014 · 9 comments
Labels

Comments

@PixelOrange
Copy link
Contributor

https://github.com/alexames/DeltaBot/blob/master/deltabot/deltabot.py#L548

This line (and all other lines with this code) are currently throwing errors that cause the sidebar to not get updated. The rest of the bot appears to be working as intended.

@amorde
Copy link
Contributor

amorde commented Apr 20, 2014

That line is intended to remove the "top1" and "top10" special CSS classes from the previous month. How does that affect the sidebar? I'll look it to it, I think I might just not completely understand the codebase just yet and might be causing side effects.

@PixelOrange
Copy link
Contributor Author

When the code is interrupted it stops and goes back to the beginning and starts a new comment. It's not error handled very well. Don't waste time trying to account error handling, though. Right now the biggest concern is figuring out why it keeps saying that the CSS is none type. It shouldn't be even if it's not a top 10.

@amorde
Copy link
Contributor

amorde commented Apr 26, 2014

So what can I do to resolve this?

@PixelOrange
Copy link
Contributor Author

Due to multiple bugs that were not immediately apparent, I'm running this code as it is the most stable copy I could revert to:

https://github.com/alexames/DeltaBot/blob/b3c905b4353403e843ad762ff34b8673d8bb47ce/deltabot/deltabot.py

Somewhere between there and the most recent version of the code, there are parsing bugs that are causing the code to fail. I don't know what exactly is causing the problem nor do I know how to fix it.

@amorde
Copy link
Contributor

amorde commented Apr 27, 2014

What can I do to test it? To me, stuff like this is a major barrier to outside contributors to the product, because I can't really see what my code does until after I've already committed it. There are some tests in there but they are not very extensive.

Since I know the code I contributed doesn't work and has caused some problems, I'm very reluctant to contribute any more in fear of introducing more bugs..

@PixelOrange
Copy link
Contributor Author

It's hard for me to test as well. I have a test environment I can run it in but I can't model it exactly like CMV so when I run it in there I get different results.

It's a conundrum.

@Acebulf
Copy link
Collaborator

Acebulf commented Apr 29, 2014

In the early days of the project we had built a reddit clone in virtualbox on which we tested the bot in "real situations".

I don't know if you guys are still using it, but if you aren't, that is a distinct possibility for testing.

@stahlous
Copy link

The update_scoreboard method runs every time the script goes through an iteration, and it calls the update_top_ten_css method, which contains the line that's throwing the exception, which causes the update_scoreboard method to bomb out as well.

It looks like you're trying to remove old flair every iteration, which is a bit redundant. Regardless of that, you must be trying to change the flair of a user that either doesn't have any flair or maybe is deleted or something like that. You could probably fix this simply with an if statement:

            if current_css:
                new_css = current_css.replace(top_1_css, '').replace(top_10_css, '').strip()
                self.subreddit.set_flair(redditor,flair_text=flair_text,flair_css_class=new_css)

@amorde
Copy link
Contributor

amorde commented May 13, 2014

Hmm I see, I'm new to PRAW and I made the poor assumption that if a user did not have flair it would just be empty. I was trying to solve the issue of the previous month's leaderboard having the CSS when they shouldn't.

On May 12, 2014, at 3:19 PM, stahlous notifications@github.com wrote:

The update_scoreboard method runs every time the script goes through an iteration, and it calls the update_top_ten_css method, which contains the line that's throwing the exception, which causes the update_scoreboard method to bomb out as well.

It looks like you're trying to remove old flair every iteration, which is a bit redundant. Regardless of that, you must be trying to change the flair of a user that either doesn't have any flair or maybe is deleted or something like that. You could probably fix this simply with an if statement:

        if current_css:
            new_css = current_css.replace(top_1_css, '').replace(top_10_css, '').strip()
            self.subreddit.set_flair(redditor,flair_text=flair_text,flair_css_class=new_css)


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants