Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8821627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:54:10+00:00 2026-06-14T05:54:10+00:00

I am quite new to python… import sys, os, time, py4chan, urllib from urllib2

  • 0

I am quite new to python…

 import sys, os, time, py4chan, urllib from urllib2 import urlopen, URLError, HTTPError

 def refreshthread(boardin,no):
     global thread
     global topic
     board = py4chan.Board(boardin)
     thread = board.getThread(int(no))
     topic = thread.topic
     time.sleep(2.5)

 def dlfile(url, folder):

     try:
         f = urlopen(url)

         with open(folder + "/" + os.path.basename(url), "wb") as local_file:
             local_file.write(f.read())
             print "Downloaded to " + str(folder + "/" + os.path.basename(url)) 

     except HTTPError, e:
         print "HTTP Error:", e.code, url
     except URLError, e:
         print "URL Error:", e.reason, url

 def getsize(uri):
     file = urllib.urlopen(uri)
     size = file.headers.get("content-length")
     file.close()
     return str(int(size) / 1024)

 def main():
     boardtag = str(raw_input("Board: "))
     threadno = int(raw_input("Thread id: "))
     folder = str(raw_input("Save to folder: "))
     print "Getting thread information..."
     refreshthread(boardtag,threadno)
     print "Subject: " + topic.Subject
     while(True):
         if not os.path.exists(folder): os.makedirs(folder)
         refreshthread(boardtag,threadno)
         for imgurl in thread.Files():
             if imgurl is not None and not os.path.exists(folder + "/" + os.path.basename(imgurl)):
                 print "A wild image appears! " + "(" + getsize(imgurl) + "kb)" 
                 dlfile(imgurl,folder)
             else:
                 pass

 if __name__ == '__main__':
     main()

I coded this on linux and it runs perfectly, but if I run this on windows, I get this error:

TypeError: __init__() takes exactly 4 arguments (2 given)

Which is quite strange as I haven’t defined init.
Could this be an init from another module?

The py4chan module seems to work fine if i code other scripts.
Both machines have same python version too.

EDIT(Full error):

Getting thread information...
Traceback (most recent call last):
  File "4chan.py", line 59, in <module>
    main()
  File "4chan.py", line 46, in main
    refreshthread(boardtag,threadno)
  File "4chan.py", line 15, in refreshthread
    board = py4chan.Board(boardin)
TypeError: __init__() takes exactly 4 arguments (2 given)

*Edit:*Okay, i had two different modules of the same name. All working now.
I shouldn’t be allowed on this website.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:54:12+00:00Added an answer on June 14, 2026 at 5:54 am

    The py4chan.Board class needs to be constructed with 3 arguments, not 1. This line in the refreshthread function:

    board = py4chan.Board(boardin)
    

    Should look something this:

    board = py4chan.Board(base_url, post_url, filesize)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am quite new to python.subprocess() if i folk a new process from python,
I'm quite new to Java and from Python and PHP, I'm used to default
I'm quite new to python, and happen to have used C# for some time
I'm creating a game, and am quite new to Python generally. I created a
i am quite new in python. I am receiving (through pyserial) string with data
I'm quite new to python, so I'm doing my usual of going through Project
I'm quite new to threading in Python and have a couple of beginner questions.
i am quite new to python, but i have quite some experience in C#.
I am quite new to programming. This is in relation to python. So the
I am new to python, and I don't quite understand the __func__ in python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.