Giter Site home page Giter Site logo

robotframework-archivelibrary's Introduction

Torilla Tavataan! Let's meet at the Market Square!

Torilla Tavataan

Let's meet at the Market Square!

Welcome to MarketSquare, a community run collection of repositories for Robot Framework.

See https://marketsquare.github.io/ on how to request access/join the MarketSquare.

For more information about the MarketSquare organization see our FAQ.

robotframework-archivelibrary's People

Contributors

aaltat avatar bbossola avatar bulkan avatar hpschry avatar kontulai avatar liuqie avatar lucagiove avatar nicomincuzzi avatar nilsty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robotframework-archivelibrary's Issues

bug in os.path.join

In ‘utils.py’,

Line 22    curdir = os.path.join(basedir, dir)
Line 42    outfile = open(os.path.join(dest, name), 'wb')

When I unzip a file which has a path in it,

unzip

The case fails. “OSError: [Errno 13] Permission denied: '/ram'”
That’s because the method ‘os.path.join’ does not work as we expect.
For example:

>>> basedir = '/home/ute/ta_kiss_files/example/BTS9_1011_CCNTrace'
>>> dir = '/ram'
>>> curdir = os.path.join(basedir, dir)
>>> print curdir
/ram

After I change the utils.py as below,

Line 22    curdir = os.path.join(basedir, dir)
Change to  curdir = basedir + '/' + dir
Line 42    outfile = open(os.path.join(dest, name), 'wb')
Change to  outfile = open(dest + '/' + name, 'wb')

Case passes, because,

>>> curdir = basedir + '/' + dir
>>> print curdir
/home/ute/ta_kiss_files/example/BTS9_1011_CCNTrace///ram
>>>

That is what we expect.

Can not unzip a zip file that does not contain directory structure

I created a ZIP file that does not contain directory strcuture. Yes, it is possible via java library.
When using Extract ZIP File keyword,an error occurs "..directory does not exist".
So I modified the code so it can create the directories and it works.

The library as it is today does not handle a ZIP file that does not contain directory structure. 7zip can handle it for example.

Here is the code that I added, we could perform it:

def extract(self, zfile, dest='.'):
...

extract files to directory structure

    for i, name in enumerate(zf.namelist()):
        azipfile = os.path.join(dest, name)
        if not name.endswith('/'):
            azipfile_parent = os.path.dirname(azipfile)
            -->if not os.path.exists(azipfile_parent):
            -->    os.makedirs(azipfile_parent)

...

Unable to create zip file in same directory as files to be zipped

Image that you a directory C:\MyDirectory with some files and you wanted to create a Zip-File of C:\MyDirectory with name C:\MyDirectory\mydirectory.zip. In this case the keyword

create_zip_from_files_in_directory( "C:\MyDirectory", "C:\MyDirectory\mydirectory.zip")

is creating an infinite loop by always trying to zip its own zip-file.

My guess is, that the following two lines must be interchanged:

the_zip = zipfile.ZipFile(filename, "w")
files = return_files_lists(directory, sub_directories)

Cannot zip hughe directories

Cannot create zipfiles > 4GB

Exception:
"...Filesize would require ZIP64 extensions"

in the python zipfile module you can add a flag "allowZip64 = True" in the cmd

maybe you can add this to your lib

Unzip fails when missing folders

Whith this zip file:

$ unzip -l /tmp/output.zip
Archive:  /tmp/output.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
     3267  2014-12-08 14:17   main/car.jpg
     3267  2014-12-08 14:17   main/cat.jpg
---------                     -------
     6534                     2 files

The unzip operation fails

Newer version number lower than previous release

Hey,

Please update version of latest release to make it work with 'pip install' by default, because earlier version (0.3.0) does not support unpacking directories, where newest (0.2.1) does.

Thanks

Can't install this library with python 3.4

Hi,

i use python 3 and when I try to make a:
pip install robotframework-archivelibrary

I got an error.

File "", line 17, in
File "/home/certivibe/test/build/robotframework-archivelibrary/setup.py", line 8, in
execfile(join(dirname(abspath(file)), 'ArchiveLibrary', 'version.py'))
NameError: name 'execfile' is not defined
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 17, in

File "/home/certivibe/test/build/robotframework-archivelibrary/setup.py", line 8, in

execfile(join(dirname(abspath(__file__)), 'ArchiveLibrary', 'version.py'))

NameError: name 'execfile' is not defined

The library fails on receving an archive with incorrectly ordered folders

The library fails when receives an archive where the folders are not created in the expected sequence, like this one:

$> unzip -l test-with-subfolders.zip 
Archive:  test-with-subfolders.zip
  Length      Date    Time    Name

        0  2014-12-05 16:26   main/zoo/
        0  2014-12-05 16:26   main/foo/
        0  2014-12-05 16:26   main/
     1542  2014-12-05 16:27   main/zoo/testcase-zoo.txt
     1542  2014-12-05 16:27   main/foo/testcase-foo.txt

     3084                     5 files

Note that such file is valid:

$> zip -T test-with-subfolders.zip 
test of test-with-subfolders.zip OK

This is what happens:

Extract Zip File With Unordered Create                                | FAIL |
OSError: [Errno 2] No such file or directory: '/tmp/zipout/main/zoo/'

7z and rar file support

This requires fallowing packages should be install

pip install --upgrade pylzma
pip install --upgrade rarfile

@bulkan can I go with?

Wrong delimiting char for M$ - '/' vs. '\\'

robot returns:
IOError: [Errno 2] No such file or directory: u'C:\ ... \folder/file.txt'
(ellipsis used to shorten real path)

i pass 'Extract Zip File' the path up to (and including) last '/' (automatically converted by robot to '' on M$) and method extracts zipped folder, but separates it with zipped file, with '/' which is for unix file-systems.

Zip file with directory structure

Ugh

If I have zip file which has subfolders and files in it. In some cases the ArchiveLibrary is not able to extract the zip file correctly. This seems be related that if I do this:

zf = zipfile.ZipFile(zfile)
print zf.namelist()

It will only print the files. Example:

['path1/file1.txt', 'path1/file2.txt', ...] 

The archive library seems to expect that also paths are also included in the zf.namelist(). Example:

['path1', 'path1/file1.txt', 'path1/file2.txt', ...] 

But one create zip file with -no-dir-entries [1] flag in Linux and then the print zf.namelist() will only list the paths to files and zip file does not contain directory entries. Then the ArchiveLibrary fill fail on this stack trace:

DEBUG   Traceback (most recent call last): File "C:\Python27\lib\site-packages\ArchiveLibrary\keywords.py", line 43, in extract_zip_file unzipper.extract(zfile, dest) File "C:\Python27\lib\site-packages\ArchiveLibrary\utils.py", line 41, in extract outfile = open(os.path.join(dest, name), 'wb'

[1]http://linux.die.net/man/1/zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.