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 8331925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:34:05+00:00 2026-06-09T02:34:05+00:00

I have a php script that I called in command line like that :

  • 0

I have a php script that I called in command line like that :

$php importTextFile.php --user "X" --title "name" notice_X.txt 

I want to use that file in a python script. I’ve tried :

for file in os.listdir("."):
    subprocess.call(["php", "-f", "importTextFile.php"], "--user=X", "--title="'%s' % name, file)

I’ve got he following error :

  File "./pageFromFile.py", line 21, in main
    subprocess.call(["php", "-f","importTextFile.php"], "--user=Bot", "--title="'%s' % nom, fichier)
  File "/usr/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 629, in __init__
    raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer

I don’t understand how to fix this error.
Thanks for your help.

edit1 : thanks it works, but I’ve got problem withs args because the Usage message appeared :

Usage: php [options] [-f] <file> [--] [args...]
       php [options] -r <code> [--] [args...]
       php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
       php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
       php [options] -- [args...]
       php [options] -a

edit2 : I’ve changed arguments’s order and it works :
[“php”, “php /script /path”, “-f”, “–user”, “X”, “–title”, X, file ]

  • 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-09T02:34:06+00:00Added an answer on June 9, 2026 at 2:34 am

    Here’s a messy explanation due to messy documentation.

    From: http://docs.python.org/library/subprocess.html#frequently-used-arguments

    To support a wide variety of use cases, the Popen constructor (and the
    convenience functions) accept a large number of optional arguments.
    For most typical use cases, many of these arguments can be safely left
    at their default values. The arguments that are most commonly needed
    are:

    From: http://docs.python.org/library/subprocess.html#subprocess.call

    The signature for call() is:

    subprocess.call(args, *, stdin=None, stdout=None, stderr=None, shell=False)
    

    You’ll want your CL arguments all within a single list – as Jakob provided. That is the first argument to call().

    The other positional arguments correspond to initialization parameters for class subprocess.Popen (http://docs.python.org/library/subprocess.html#subprocess.Popen). bufsize happens to be one of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that runs on the command line, called by a crontab.
I have a PHP script that's being called through jQuery AJAX. I want the
I have a php script that gets called via an ajax call. Values are
I have a PHP script that very much like a commenting system, but requires
I have a php script that outputs a random image each time it's called.
I have a PHP script that runs this command: system(pdftohtml -i -noframes /home/myacc/pdfs/test.pdf); When
I have the following php script that is called by jquery ajax function report_range($time,
I have a php script that is being called by an ajax post. I
i'm working on a php script that is called by frontlinesms and I have
I have a PHP script that's called by an external vendor. One of the

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.