[Tutor] RuntimeError: file does not exist

Susana Iraiis Delgado Rodriguez susana.delgado_s at utzmg.edu.mx
Thu May 19 16:16:58 CEST 2011


Hello everyone!

Well, I tried this code in other computer and it worked just fine. I changed
the line:
    lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
    for lyr.datasource = mapnik.Shapefile(base=ruta,file=archivo[0])
I also did hard coding to test my script:
    lyr.datasource =
mapnik.Shapefile(file='C:\\Python26\\tapalpa_05_plani_line')
It also worked as well!!

But when I run the module in my computer it throws many errors, if I use
lyr.datasource = mapnik.Shapefile(base=ruta,file=archivo[0]), it shows
Python Runtime Error: wrong file code: -1991225785



2011/5/19 Brad Posthumus <mcgooly at yahoo.com>

>
>
>
> Susana Iraiis Delgado Rodriguez wrote:
> >
> > Hello Alan!!
> > Can you please tell me, how to rebuild my path? I've tried it, but I
> > didn't
> > succed =(
> >
> >
>
> The doctest for the Shapefile function includes this line:
>
>   >>> shp = Shapefile(base='/home/mapnik/data',file='world_borders')
>
> This tells you "base" is a path, and "file" is your shapefile.
>
> In your code below, you're using the full path of the shapefile for both
> parameters. Fortunately, your code already seems to provide both required
> inputs. Try changing this line:
>
> lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
>
> ...to:
>
> lyr.datasource = mapnik.Shapefile(base=ruta, file=filename)
>
> ---------------
> Brad Posthumus
>
> --
> View this message in context:
> http://old.nabble.com/-Tutor--RuntimeError%3A-file-does-not-exist-tp31640074p31655637.html
> Sent from the Python - tutor mailing list archive at Nabble.com.
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110519/f66dbd10/attachment.html>


More information about the Tutor mailing list