Download Data Dari GDELT PROJECT

Mohon bimbingan om, saya berusaha buat tarik dari gdelt (pakai script orang, karena belum begitu ngerti python. hehehe). Tapi scriptnya mandeg ketika parsing,

 print('parsing,'),
    for infile_name in glob.glob(local_path + 'tmp/*'):
        outfile_name = local_path + 'country/' + fips_country_code + '%04i.tsv' % outfilecounter

        # open the infile and outfile
        with open(infile_name, mode='r') as infile, open(outfile_name, mode='w') as outfile:
            for line in infile:
                # extract lines with our interest country code
                if fips_country_code in operator.itemgetter(51, 37, 44)(line.split('\t')):
                    outfile.write(line)
            outfilecounter += 1

        # delete the temporary file
        os.remove(infile_name)
    infilecounter += 1

keterangan yang muncul seperti ini

 FileNotFoundError                     Traceback (most recent call last)
<ipython-input-2-49b3df7b3a42> in <module>()
     46
     47         # open the infile and outfile
---> 48         with open(infile_name, mode='r') as infile, open(outfile_name, mode='w') as outfile:
     49             for line in infile:
     50                 # extract lines with our interest country code

FileNotFoundError: [Errno 2] No such file or directory: 'country/ID0000.tsv'


Mohon bimbingan itu kenapa dan ngatasinya gimana?

avatar elsetiyawan
@elsetiyawan

16 Kontribusi 1 Poin

Diperbarui 6 tahun yang lalu

1 Jawaban:

file 'infile_name' dan 'outfile_name' Tidak ditemukan, pastikan nama file sudah sesuai

avatar lukmanfreedom
@lukmanfreedom

121 Kontribusi 55 Poin

Dipost 6 tahun yang lalu

Login untuk ikut Jawaban