pbfy0 / visvis

Automatically exported from code.google.com/p/visvis
Other
0 stars 0 forks source link

path.find('.zip') does not detect executable zip files created by cxfreeze on Windows #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use cxfreeze (e.g. 4.2.3) script from command shell on Win7 in a project 
that has visvis
2. run the frozen program
3.

What is the expected output? What do you see instead?

At run-time there is a failure at line 45 of visvis/functions/__init__.py 

    files = os.listdir(path)

because execution is in fact in a zipfile but it has not been detected at line 
35

    i = path.find('.zip')
.

What version of the product are you using? On what operating system?

visvis 1.8
Win7
python 2.6.6
cxfreeze 4.2.3

Please provide any additional information below.

In some situations the cxfreeze script puts everything into a file that has 
extension ".exe". This executable zip file is both an executable (you can run 
it), and zip file (you can open and explore it with 7zip).

My fix was to replace 
i=path.find('.zip')  with
i=max(path.find('.zip'), path.find('.exe'))
but that is a bit cryptic and maybe not very robust.
One option is to use zipfile.is_zipfile(partialpath) but then there is still a 
need to generate candidate partialpath values from path.
Would be nice if there were a function zipfile.is_in_zipfile(path).

Original issue reported on code.google.com by owe...@hotmail.com on 13 Feb 2013 at 3:56

GoogleCodeExporter commented 9 years ago

Original comment by almar.klein@gmail.com on 13 Feb 2013 at 3:59

GoogleCodeExporter commented 9 years ago
maybe this

inzipfile = lambda path:any([zipfile.is_zipfile(path[:k]) for k in 
range(len(os.path.normpath(path))) if os.path.normpath(path)[k]==os.sep] )

Original comment by owe...@hotmail.com on 13 Feb 2013 at 4:21

GoogleCodeExporter commented 9 years ago
Also, this test "find('.zip')" is present in other visis files than just 
function/__init__

Original comment by owe...@hotmail.com on 13 Feb 2013 at 4:22

GoogleCodeExporter commented 9 years ago

Original comment by almar.klein@gmail.com on 7 Mar 2013 at 4:22

GoogleCodeExporter commented 9 years ago
This issue was closed by revision c09cdf920a7e.

Original comment by almar.klein@gmail.com on 9 Mar 2013 at 1:26