I’ve got my project, a single .py file in the root directory, which loads several different python classes from the modules directory.
My first question is one of order: There are several processes in my app which query external APIs, download the results to local storage, then import those results to the database. The files that are saved to disk are all sequentially named files. “download-001.json, download-002.json, etc”, and they’re downloaded serially and in order, so ordering them by name, creation date, modified date should all result in them being in order
When I import these files, as in:
for filename in os.listdir(self.data_dir): do_stuff()
My logging indicates they are imported in more or less a random order. Not only that, but the order changes every time they are imported. There aren’t any negative repercussions from this, but I’m wondering why these aren’t being imported in order? Just to file away some knowledge.
submitted by /u/identicalBadger
[link] [comments]
r/learnpython I’ve got my project, a single .py file in the root directory, which loads several different python classes from the modules directory. My first question is one of order: There are several processes in my app which query external APIs, download the results to local storage, then import those results to the database. The files that are saved to disk are all sequentially named files. “download-001.json, download-002.json, etc”, and they’re downloaded serially and in order, so ordering them by name, creation date, modified date should all result in them being in order When I import these files, as in: for filename in os.listdir(self.data_dir): do_stuff() My logging indicates they are imported in more or less a random order. Not only that, but the order changes every time they are imported. There aren’t any negative repercussions from this, but I’m wondering why these aren’t being imported in order? Just to file away some knowledge. submitted by /u/identicalBadger [link] [comments]
I’ve got my project, a single .py file in the root directory, which loads several different python classes from the modules directory.
My first question is one of order: There are several processes in my app which query external APIs, download the results to local storage, then import those results to the database. The files that are saved to disk are all sequentially named files. “download-001.json, download-002.json, etc”, and they’re downloaded serially and in order, so ordering them by name, creation date, modified date should all result in them being in order
When I import these files, as in:
for filename in os.listdir(self.data_dir): do_stuff()
My logging indicates they are imported in more or less a random order. Not only that, but the order changes every time they are imported. There aren’t any negative repercussions from this, but I’m wondering why these aren’t being imported in order? Just to file away some knowledge.
submitted by /u/identicalBadger
[link] [comments]