Python Forum
ThreadPoolExecutor read file to list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ThreadPoolExecutor read file to list
#1
Hi,

I'm trying to create a multithreaded file read. Which has to read multiple files to different lists which further in the code will have to be handled. But I'm not able to get this code running without having a traceback call.
I also tried to call different def functions, but that's not working also. The function keeps the thread locked before continuing to the next.

( If this is a newby question I sorry, that's what I am. Blush )

Any hints on how to achieve this?

from concurrent.futures import ThreadPoolExecutor

with ThreadPoolExecutor(max_workers=4) as e:
    e.submit(ArtLev = list(open(ArtLev_filename, encoding='ANSI')))
    e.submit(ArtPrijs = list(open(ArtPrijs_filename, encoding='ANSI')))
Error:
Traceback (most recent call last): File "C:/Users/danie/OneDrive_MLM/OneDrive/Daniel/PyScripts/MultiThread/MultiProcess_FileMatch_test1.py", line 127, in <module> e.submit(ArtLev = list(open(ArtLev_filename, encoding='ANSI'))) TypeError: submit() missing 1 required positional argument: 'fn'
Reply


Messages In This Thread
ThreadPoolExecutor read file to list - by DaLiPy - Jun-10-2019, 07:59 PM
RE: ThreadPoolExecutor read file to list - by Yoriz - Jun-10-2019, 08:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Connecting to Remote Server to read contents of a file ChaitanyaSharma 1 295 May-03-2024, 07:23 AM
Last Post: Pedroski55
  PyYAML read list of int zisco 2 388 Apr-02-2024, 12:36 PM
Last Post: zisco
  Recommended way to read/create PDF file? Winfried 3 2,987 Nov-26-2023, 07:51 AM
Last Post: Pedroski55
  python Read each xlsx file and write it into csv with pipe delimiter mg24 4 1,630 Nov-09-2023, 10:56 AM
Last Post: mg24
  How to read module/class from list of strings? popular_dog 1 536 Oct-04-2023, 03:08 PM
Last Post: deanhystad
  read file txt on my pc to telegram bot api Tupa 0 1,188 Jul-06-2023, 01:52 AM
Last Post: Tupa
  parse/read from file seperated by dots giovanne 5 1,175 Jun-26-2023, 12:26 PM
Last Post: DeaD_EyE
  Formatting a date time string read from a csv file DosAtPython 5 1,436 Jun-19-2023, 02:12 PM
Last Post: DosAtPython
  How do I read and write a binary file in Python? blackears 6 7,358 Jun-06-2023, 06:37 PM
Last Post: rajeshgk
  Read csv file with inconsistent delimiter gracenz 2 1,254 Mar-27-2023, 08:59 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020