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

TypeError: '_asyncio.Future' object is not callable #67

Closed
RohitDhankar opened this issue Aug 29, 2023 · 2 comments · Fixed by #69
Closed

TypeError: '_asyncio.Future' object is not callable #67

RohitDhankar opened this issue Aug 29, 2023 · 2 comments · Fixed by #69
Assignees

Comments

@RohitDhankar
Copy link
Owner

RohitDhankar commented Aug 29, 2023

(dbfs_env) dhankar@dhankar-1:~/.../torn$ python file_upload.py --put fl_2.txt --GOT Filenames --- ['fl_2.txt'] HTTP PUT - Upload fl_2.txt: Traceback (most recent call last): File "file_upload.py", line 202, in <module> asyncio.run(main()) File "/home/dhankar/anaconda3/envs/dbfs_env/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/home/dhankar/anaconda3/envs/dbfs_env/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "file_upload.py", line 194, in main tasks.add(method(filenames)) TypeError: '_asyncio.Future' object is not callable

@RohitDhankar
Copy link
Owner Author

(dbfs_env) dhankar@dhankar-1:~/.../torn$ python file_upload.py --put fl_2.txt --GOT Filenames --- ['fl_2.txt'] Traceback (most recent call last): File "file_upload.py", line 202, in <module> asyncio.run(main()) File "/home/dhankar/anaconda3/envs/dbfs_env/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/home/dhankar/anaconda3/envs/dbfs_env/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "file_upload.py", line 186, in main put_obj = Put() TypeError: __init__() missing 1 required positional argument: 'filenames'

@RohitDhankar
Copy link
Owner Author

async def main():
    """
    Returns
    -------
    None.

    """
    define("put", type=bool, help="Use PUT instead of POST", group="file uploader")

    # Tornado configures logging from command line opts and returns remaining args
    filenames = options.parse_command_line()
    
    
    if not filenames:
        print("Provide a list of filenames to upload.", file=sys.stderr)
        sys.exit(1)
    
    print("--GOT Filenames ---",filenames)
    put_obj = Put(filenames)
    post_obj = Post(filenames)

    method = put_obj.run() if options.put else post_obj.run()

    # Main coroutine, starting tasks:
    cond = asyncio.Condition()
    tasks = set()
    tasks.add(method(filenames))
    asyncio.gather(*(task.start(cond, tasks) for task in tasks))

    # Wait for the number of tasks to reach 0
    async with cond:
        await cond.wait_for(lambda: len(tasks) == 0)
        print("ALL TASKS are COMPLETED, EXITING.")

asyncio.run(main())

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

Successfully merging a pull request may close this issue.

1 participant