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

  • Home
  • SEARCH
  • 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 9017541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:18:07+00:00 2026-06-16T04:18:07+00:00

What is wrong with this python source code? import threading import subprocess as sub

  • 0

What is wrong with this python source code?

import threading
import subprocess as sub

def ben(fil):
    pr = sub.Popen(fil,stdout=sub.PIPE,stderr=sub.PIPE)
    output, errors = pr.communicate()
    print output

theapp = '''blender
            blender-softwaregl'''.split()
print theapp

for u in theapp:
    print u
    tr = threading.Thread(target=ben, args=(u))
    tr.daemon = True
    tr.start()

The error is :

['blender', 'blender-softwaregl']
blender
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
TypeError: ben() takes exactly 1 argument (7 given)

blender-softwaregl
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
TypeError: ben() takes exactly 1 argument (18 given)

This is my problem.What is this error?

 TypeError: ben() takes exactly 1 argument (18 given)
  • 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-16T04:18:08+00:00Added an answer on June 16, 2026 at 4:18 am

    The args argument to threading.Thread expects a sequence, but you’re providing a string. This is causing it to interpret each letter of the strings as an individual argument, resulting in too many arguments for your target function.

    You’re very close to having the right code. You just need to fix your tuple syntax by adding a trailing comma in the parenthases:

    tr = threading.Thread(target=ben, args=(u,)) # comma makes args into a 1-tuple
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whats wrong with this code? -(void) drawRect:(CGRect) rect { CGContextRef c = UIGraphicsGetCurrentContext(); if
Is there anything wrong with this code or can this be done more efficiently?
what's wrong with this code in Google Chrome r = webkitIndexedDB.open(db_name,1); r.onsuccess = success_callback;
What's wrong with this code?: SolverContext sc = SolverContext.GetContext(); Model m = sc.CreateModel(); m.AddDecision(new
http://code.google.com/p/python-hidden-markov/source/browse/trunk/Markov.py Contains a class HMM , which inherits from BayesianModel , which is a
I am trying implement rsync with python. Here's my code. #!/usr/bin/python import os url
I have a python script which uses subprocess.Popen to run multiple instances of another
What wrong with this validation: Jquery: $(document).ready(function(){ $(#addcmd).attr(disabled,disabled); $(#cmdstxt).keypress( function(event){ var txt=$(#cmdstxt); if( txt.val().length
Why is this wrong? <table> <form> <tr><td>something something</td/> </form> </table> I'm talking about position
Whats wrong with this picture? Model: validates_acceptance_of :terms_of_service, :on => :create, :accept => true,

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.