Menu

#1 Windows Error

open
None
9
2008-12-23
2008-11-26
Ludwig
No

When you run it on Windows, the program creates the error that a temp file could not be opened, from Layer.py when doing a copy. This is because Windows has the annoying habit of not being able to open files twice.

If you change the line in Layer.py, l. 482 or so to:

shutil.copyfileobj(tmplay, self.fhlay)

instead of the file copy operation it runs ok.

Discussion

  • Ludwig

    Ludwig - 2008-11-26

    Unfortunately, it is not quite this easy. First of all you need to do a tmplay.seek(0) first to reset (poorly documented in Python), but even then the Windows version does not create the same file as the Linux one. I have the feeling that this is because the file does not flush...F*cking Vista...

     
  • Ludwig

    Ludwig - 2008-11-27

    diff for Layer.py

     
  • Ludwig

    Ludwig - 2008-11-27

    Again...I think I cracked it now. There were two problems to run it on Windoze.

    The first one I reported with the temporary file, the other being that the flag for writing a binary file was missing.

    Now I can create an imi file on Windows that opens correctly in VP. It still differs in the binary form from the Linux created one, but I believe that is merely a question of ordering the layers (I assume that different hash-maps are used, so when iterating over them they come out in different orders).

    In the diff file I have attached, which applies to the Layers.py file only I made accordingly two changes:
    the first being a "wb" flag for opening the layer file (I have not checked any of the other "w" flags, maybe they should change as well.
    the second to switch over to StringIO as a replacement for a temporary file: I have used only a small OSM file for this and it might not be good for very large OSM files, but it resolves the problem on Windows where temporary files appear not to flush.

    File Added: Layerpy.diff

     
  • Henrik Johansson

    • priority: 5 --> 9
    • assigned_to: nobody --> lhj
    • status: open --> pending
     
  • Henrik Johansson

    Hi,

    Thanks for finding this problem. I have never tried it in other OSes than Linux.

    I am trying to apply the patch but it would be nice to keep the temporary file for large maps. Are you sure it is not working with tempfile if the seek and copyfileobj is used for the final copying?

     
  • Henrik Johansson

    • status: pending --> open
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.