Python Forum
zip file variable prints <zipfile.ZipFile object at 0x7f83fd13bd90> ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
zip file variable prints <zipfile.ZipFile object at 0x7f83fd13bd90> ?
#4
import os
import zipfile


n1_4222_log = '/home/rsh/tibco_logs/emsn1_4222'

print('Checking dir: %s' % n1_4222_log)
dir_files = os.listdir(n1_4222_log)
archive_log = '/home/rsh/tibco_logs/emsn1_4222/archive'
print archive_log

for log_file_name in dir_files:

    if log_file_name == "archive":
        print(' Its Archive dir no need to zip %s' % log_file_name)
    else:
        print('Its log file %s' % log_file_name)
        zip_file_name = zipfile.ZipFile(n1_4222_log + '/' + log_file_name + ".zip", "w")
        print(zip_file_name)
        zip_file_name.write(n1_4222_log, compress_type = zipfile.ZIP_DEFLATED)
        print zip_file_name
[output]

Checking dir: /home/rsh/tibco_logs/emsn1_4222
/home/rsh/tibco_logs/emsn1_4222/archive
Its log file log
<zipfile.ZipFile object at 0x7f83fd13bd90>
<zipfile.ZipFile object at 0x7f83fd13bd90>
Its Archive dir archive
Its log file no need to zip log11
<zipfile.ZipFile object at 0x7f83fd13bdd0>
<zipfile.ZipFile object at 0x7f83fd13bdd0>
Its log file log12
<zipfile.ZipFile object at 0x7f83fd13bd90>
<zipfile.ZipFile object at 0x7f83fd13bd90>
Its log file log13
<zipfile.ZipFile object at 0x7f83fd13bdd0>
<zipfile.ZipFile object at 0x7f83fd13bdd0>
Its log file log14
<zipfile.ZipFile object at 0x7f83fd13bd90>
<zipfile.ZipFile object at 0x7f83fd13bd90>
Its log file log15
<zipfile.ZipFile object at 0x7f83fd13bdd0>
<zipfile.ZipFile object at 0x7f83fd13bdd0>
Its log file log11.zip
<zipfile.ZipFile object at 0x7f83fd13bd90>
<zipfile.ZipFile object at 0x7f83fd13bd90>

I am using python v2.7.5
in the dir, i can see this logs got zipped

-rw-rw-r-- 1 rsh rsh 976785 Dec 21 2018 log
drwxrwxr-x 2 rsh rsh 66 Jun 19 12:15 archive
-rw-rw-r-- 1 rsh rsh 976785 Jun 19 12:20 log15
-rw-rw-r-- 1 rsh rsh 976785 Jun 19 12:20 log14
-rw-rw-r-- 1 rsh rsh 976785 Jun 19 12:20 log13
-rw-rw-r-- 1 rsh rsh 976785 Jun 19 12:20 log12
-rw-rw-r-- 1 rsh rsh 976785 Jun 19 12:20 log11
-rw-rw-r-- 1 rsh rsh 182 Jun 24 09:05 log.zip
-rw-rw-r-- 1 rsh rsh 182 Jun 24 09:05 log15.zip
-rw-rw-r-- 1 rsh rsh 182 Jun 24 09:05 log14.zip
-rw-rw-r-- 1 rsh rsh 182 Jun 24 09:05 log13.zip
-rw-rw-r-- 1 rsh rsh 182 Jun 24 09:05 log12.zip
-rw-rw-r-- 1 rsh rsh 182 Jun 24 09:05 log11.zip

[output]

Error:
<zipfile.ZipFile object at 0x7f83fd13bd90>
Reply


Messages In This Thread
RE: zip file issue - by heiner55 - Jun-25-2019, 05:49 PM
RE: zip file variable prints <zipfile.ZipFile object at 0x7f83fd13bd90> ? - by Rsh - Jun-26-2019, 02:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using zipfile module - finding folders not files darter1010 2 296 Apr-06-2024, 07:22 AM
Last Post: Pedroski55
  zipfile module error pseudo 3 810 Jun-30-2023, 03:52 PM
Last Post: Gribouillis
  zfill prints extra et the end of a var tester_V 4 922 Mar-24-2023, 06:59 PM
Last Post: tester_V
  [Solved by deanhystad] Create a zip file using zipfile library DZ_Galaxy 2 1,195 Aug-17-2022, 04:57 PM
Last Post: DZ_Galaxy
  Can ZipFile be used to extract hidden files? AiedailEclipsed 0 1,653 Mar-22-2022, 05:21 PM
Last Post: AiedailEclipsed
  variable prints without being declared. ClockPillow 2 1,827 Jul-11-2021, 12:13 AM
Last Post: ClockPillow
  Created zipfile without all the subfolder? korenron 3 3,817 Jun-23-2021, 12:44 PM
Last Post: korenron
  Create ZIP file not working using ZipFile? korenron 1 2,138 Jun-13-2021, 04:15 PM
Last Post: korenron
  Output prints Account.id at the end? LastStopDEVS 5 2,825 Dec-19-2020, 05:59 AM
Last Post: buran
  Defining an object's argument whose name is stored in a variable arbiel 2 2,208 Dec-11-2020, 10:19 PM
Last Post: arbiel

Forum Jump:

User Panel Messages

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