I have tried that by removing the subfolder but its giving an error import zipfile def zipfolder(): zf = zipfile.ZipFile('/home/praveen/job_files/seq_data/PCGENE_Format.zip') fil = zf.open('/home/praveen/job_files/seq_data/PCGENE_Format.zip/NPKGTS1') print fil error: There is no item named '/home/praveen/job_files/seq_data/PCGENE_Format.zip/NPKGTS1' in the archive"
On Thu, Jun 14, 2012 at 3:46 PM, Anthony <abasta...@gmail.com> wrote: > Are there subfolders in the zipfile? I would think you would want to use > the full name (including path) to extract/open the file, not just the > filename: > > for name in zf.namelist(): > print zf.open(name) > > Anthony > > > On Thursday, June 14, 2012 7:37:36 AM UTC-4, praveen krishna wrote: >> >> Hi, >> I have found the mistake ,the problem is in opening the file.I have >> tried in python. >> if my code is >> zipfile.ZipFile('/home/**praveen/job_files/seq_data/**PCGENE_Format.zip') >> for name in zf.namelist(): >> filename = name.split('/')[-1] >> print filename >> >> o7p >> zipfolder() >> N77CDR1K.ATD >> NGFP_TRK.1 >> NP7C1TRK.1D >> NPKGTS1 >> >> >> import zipfile >> def zipfolder(): >> zf = zipfile.ZipFile('/home/**praveen/job_files/seq_data/** >> PCGENE_Format.zip') >> for name in zf.namelist(): >> filename = name.split('/')[-1] >> raw_seq = zf.open(filename) >> print raw_seq >> error: >> >> KeyError: "There is no item named 'N77CDR1K.ATD' in the archive" >> import zipfile >> def zipfolder(): >> zf = zipfile.ZipFile('/home/**praveen/job_files/seq_data/** >> PCGENE_Format.zip') >> for name in zf.namelist(): >> filename = name.split('/')[-1] >> raw_seq = zf.open(name) >> print raw_seq >> >> o/p >> zipfolder() >> <zipfile.ZipExtFile object at 0x2401d10> >> <zipfile.ZipExtFile object at 0x2401d50> >> <zipfile.ZipExtFile object at 0x2401d10> >> <zipfile.ZipExtFile object at 0x2401d50> >> <zipfile.ZipExtFile object at 0x232f350> >> I am unable to extract the entity in a file with the module zipfile.Is >> there any possibility with this module if not can you suggest me any other >> python module.I am attaching one of my sample file to this mail. >> >> >> >> On Tue, Jun 12, 2012 at 10:53 PM, pbreit <pbreitenb...@gmail.com> wrote: >> >>> Pretty hard to follow. >>> >>> One thing: you might need a db.commit() after rec.update_record(raw_** >>> seq=**file_raw,processed_seq=**rev) since it's looping. >>> >>> Can you browse your DB to see what exactly is in it? If it's SQLite, you >>> can use a Firefox addon: >>> https://addons.mozilla.org/en-**US/firefox/addon/sqlite-**manager/<https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/> >>> >>> Or add a print statement which will output in a console somewhere: >>> >>> filename = name.split('/')[-1] >>> print filename >>> >>> >>> >>