Re: [Tutor] RuntimeError: file does not exist

2011-05-19 Thread Susana Iraiis Delgado Rodriguez
Hi Alan!!

After I read your e-mail, I remebered that I run the scripts in a different
way.
The script worked properly when I run it from Python IDLE, I don't have any
idea the reason why.


2011/5/19 Alan Gauld 

>
> "Susana Iraiis Delgado Rodriguez"  wrote
>
>
>  Well, I tried this code in other computer and it worked just fine.
>>
>
>
>> But when I run the module in my computer it throws many errors,
>>
>
> So what is different between the computers?
> What are the respective OS versions and Python versions?
>
> How exactly are you running the code on each
> computer - double click in exporer, from IDLE,  from the command line?
>
> Its hard to tell what the problem is from your description.
>
>
>  lyr.datasource = mapnik.Shapefile(base=ruta,file=archivo[0]), it shows
>> Python Runtime Error: wrong file code: -1991225785
>>
>
> But that looks odd, possibly a problem with the python script file itself?
>
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-19 Thread Alan Gauld


"Susana Iraiis Delgado Rodriguez"  
wrote




Well, I tried this code in other computer and it worked just fine.




But when I run the module in my computer it throws many errors,


So what is different between the computers?
What are the respective OS versions and Python versions?

How exactly are you running the code on each
computer - double click in exporer, from IDLE,  from the command line?

Its hard to tell what the problem is from your description.

lyr.datasource = mapnik.Shapefile(base=ruta,file=archivo[0]), it 
shows

Python Runtime Error: wrong file code: -1991225785


But that looks odd, possibly a problem with the python script file 
itself?


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-19 Thread Susana Iraiis Delgado Rodriguez
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 

>
>
>
> 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@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-19 Thread Brad Posthumus



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@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-18 Thread Prasad, Ramit
Try hard coding it to test, but it probably wants base as the directory and 
file as the filename:
mapnik.Shapefile(base="C:\\", file=' Ýndice.shp')


Ramit



Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

From: tutor-bounces+ramit.prasad=jpmchase@python.org 
[mailto:tutor-bounces+ramit.prasad=jpmchase@python.org] On Behalf Of Susana 
Iraiis Delgado Rodriguez
Sent: Wednesday, May 18, 2011 9:45 AM
To: Alan Gauld
Cc: tutor@python.org
Subject: Re: [Tutor] RuntimeError: file does not exist

Hello Alan!!
Can you please tell me, how to rebuild my path? I've tried it, but I didn't 
succed =(
2011/5/17 Alan Gauld 
mailto:alan.ga...@btinternet.com>>

"Susana Iraiis Delgado Rodriguez" 
mailto:susana.delgad...@utzmg.edu.mx>> wrote

message which tells me the file I want to work with
doesn't exist, but it does.

I don't believe you! :-)
Traceback (most recent call last):...

   lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
   return CreateDatasource(keywords)
RuntimeError: C:\Ýndice.shp/C:\Ýndice does not exist

That "file name" has two C: in it which I am pretty sure is
an illegal path in Windows. Therfore the file cannot exist.

You just need to build your path correctly I suspect.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



___
Tutor maillist  -  Tutor@python.org<mailto:Tutor@python.org>
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to European legal entities.___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-18 Thread Walter Prins
On 18 May 2011 15:45, Susana Iraiis Delgado Rodriguez <
susana.delgad...@utzmg.edu.mx> wrote:

> Hello Alan!!
> Can you please tell me, how to rebuild my path? I've tried it, but I didn't
> succed =(
>
> Always post the code you tried, and the full error message you received,
otherwise you make it unneccesarily hard for us to try and help you (in
which case many people might not bother to try.)

Thanks,

Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-18 Thread Susana Iraiis Delgado Rodriguez
Hello Alan!!
Can you please tell me, how to rebuild my path? I've tried it, but I didn't
succed =(

2011/5/17 Alan Gauld 

>
> "Susana Iraiis Delgado Rodriguez"  wrote
>
>
>  message which tells me the file I want to work with
>> doesn't exist, but it does.
>>
>
> I don't believe you! :-)
>
>  Traceback (most recent call last):...
>>
>>lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
>>return CreateDatasource(keywords)
>> RuntimeError: C:\Ýndice.shp/C:\Ýndice does not exist
>>
>
> That "file name" has two C: in it which I am pretty sure is
> an illegal path in Windows. Therfore the file cannot exist.
>
> You just need to build your path correctly I suspect.
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-17 Thread Alan Gauld


"Susana Iraiis Delgado Rodriguez"  
wrote



message which tells me the file I want to work with
doesn't exist, but it does.


I don't believe you! :-)


Traceback (most recent call last):...
lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
return CreateDatasource(keywords)
RuntimeError: C:\Ýndice.shp/C:\Ýndice does not exist


That "file name" has two C: in it which I am pretty sure is
an illegal path in Windows. Therfore the file cannot exist.

You just need to build your path correctly I suspect.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-17 Thread Susana Iraiis Delgado Rodriguez
Hello Emile!

Well, I changed the values because if I assigned different values, anyways I
got the next error:
Traceback (most recent call last):
  File "", line 1, in 
  File "imagen_shp.py", line 32, in 
lyr.datasource = mapnik.Shapefile(base=raiz, file=archivo[0])
  File "C:\mapnik-0.7.1\python\2.6\site-packages\mapnik\__init__.py", line
282,
in Shapefile
return CreateDatasource(keywords)
RuntimeError: Ýndice does not exist

2011/5/17 Emile van Sebille 

> On 5/17/2011 10:10 AM Susana Iraiis Delgado Rodriguez said...
>
>  Hello list!!
>>
>> I'm using a python dll to create images out from shapefiles. I import a
>> python module and its functions, when I want to use this library, I get
>> a message which tells me the file I want to work with doesn't exist, but
>> it does. I'm running the script from Windows. This is the code:
>> import mapnik
>> import os,fnmatc
>> file_list = []
>> folders = None
>> for root, folders, files in os.walk( "C:\\" ):
>> for filename in fnmatch.filter(files, '*.shp'):
>> file_list.append(os.path.join(root, filename))
>> for row, filepath in enumerate(file_list, start=1):
>> (ruta, filename) = os.path.split(filepath)
>> i = archivo[0]+'.png'
>> m = mapnik.Map(800,500,"+proj=latlong +datum=WGS84")
>> m.background = mapnik.Color('#f2eff9')
>> s = mapnik.Style()
>> r=mapnik.Rule()
>> r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('steelblue')))
>>
>>
>> r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1))
>> s.rules.append(r)
>> m.append_style('My Style',s)
>> lyr = mapnik.Layer('world',"+proj=latlong +datum=WGS84")
>> lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
>> lyr.styles.append('My Style')
>> m.layers.append(lyr)
>> m.zoom_to_box(lyr.envelope())
>> mapnik.render_to_file(m,i, 'png')
>> print "Listo"
>> I get the next error:
>> Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
>> (Intel)] on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>  >>> import imagen_shp
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "imagen_shp.py", line 32, in 
>> lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
>>
>
>
> Without having actually dug into this, should base and file have the same
> value?
>
> Emile
>
>
>File "C:\mapnik-0.7.1\python\2.6\site-packages\mapnik\__init__.py",
>> line 282,
>> in Shapefile
>> return CreateDatasource(keywords)
>> RuntimeError: C:\Ýndice.shp/C:\Ýndice does not exist
>>  >>>
>> I also reviewed the line which causes the error, it's a script from the
>> mapnik library:
>> def Shapefile(**keywords):
>> """Create a Shapefile Datasource.
>> Required keyword arguments:
>>   file -- path to shapefile without extension
>> Optional keyword arguments:
>>   base -- path prefix (default None)
>>   encoding -- file encoding (default 'utf-8')
>>  >>> from mapnik import Shapefile, Layer
>>  >>> shp = Shapefile(base='/home/mapnik/data',file='world_borders')
>>  >>> lyr = Layer('Shapefile Layer')
>>  >>> lyr.datasource = shp
>> """
>> keywords['type'] = 'shape'
>> return CreateDatasource(keywords)
>> Does anyone could help me?
>>
>>
>>
>> ___
>> Tutor maillist  -  Tutor@python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] RuntimeError: file does not exist

2011-05-17 Thread Emile van Sebille

On 5/17/2011 10:10 AM Susana Iraiis Delgado Rodriguez said...

Hello list!!

I'm using a python dll to create images out from shapefiles. I import a
python module and its functions, when I want to use this library, I get
a message which tells me the file I want to work with doesn't exist, but
it does. I'm running the script from Windows. This is the code:
import mapnik
import os,fnmatc
file_list = []
folders = None
for root, folders, files in os.walk( "C:\\" ):
 for filename in fnmatch.filter(files, '*.shp'):
 file_list.append(os.path.join(root, filename))
for row, filepath in enumerate(file_list, start=1):
 (ruta, filename) = os.path.split(filepath)
 i = archivo[0]+'.png'
 m = mapnik.Map(800,500,"+proj=latlong +datum=WGS84")
 m.background = mapnik.Color('#f2eff9')
 s = mapnik.Style()
 r=mapnik.Rule()
 r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('steelblue')))

r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1))
 s.rules.append(r)
 m.append_style('My Style',s)
 lyr = mapnik.Layer('world',"+proj=latlong +datum=WGS84")
 lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
 lyr.styles.append('My Style')
 m.layers.append(lyr)
 m.zoom_to_box(lyr.envelope())
 mapnik.render_to_file(m,i, 'png')
print "Listo"
I get the next error:
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import imagen_shp
Traceback (most recent call last):
   File "", line 1, in 
   File "imagen_shp.py", line 32, in 
 lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)



Without having actually dug into this, should base and file have the 
same value?


Emile



   File "C:\mapnik-0.7.1\python\2.6\site-packages\mapnik\__init__.py",
line 282,
in Shapefile
 return CreateDatasource(keywords)
RuntimeError: C:\Ýndice.shp/C:\Ýndice does not exist
 >>>
I also reviewed the line which causes the error, it's a script from the
mapnik library:
def Shapefile(**keywords):
"""Create a Shapefile Datasource.
 Required keyword arguments:
   file -- path to shapefile without extension
 Optional keyword arguments:
   base -- path prefix (default None)
   encoding -- file encoding (default 'utf-8')
 >>> from mapnik import Shapefile, Layer
 >>> shp = Shapefile(base='/home/mapnik/data',file='world_borders')
 >>> lyr = Layer('Shapefile Layer')
 >>> lyr.datasource = shp
"""
keywords['type'] = 'shape'
 return CreateDatasource(keywords)
Does anyone could help me?



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] RuntimeError: file does not exist

2011-05-17 Thread Susana Iraiis Delgado Rodriguez
Hello list!!

I'm using a python dll to create images out from shapefiles. I import a
python module and its functions, when I want to use this library, I get a
message which tells me the file I want to work with doesn't exist, but it
does. I'm running the script from Windows. This is the code:
import mapnik
import os,fnmatc
file_list = []
folders = None
for root, folders, files in os.walk( "C:\\" ):
for filename in fnmatch.filter(files, '*.shp'):
file_list.append(os.path.join(root, filename))
for row, filepath in enumerate(file_list, start=1):
(ruta, filename) = os.path.split(filepath)
i = archivo[0]+'.png'
m = mapnik.Map(800,500,"+proj=latlong +datum=WGS84")
m.background = mapnik.Color('#f2eff9')
s = mapnik.Style()
r=mapnik.Rule()
r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('steelblue')))

r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1))
s.rules.append(r)
m.append_style('My Style',s)
lyr = mapnik.Layer('world',"+proj=latlong +datum=WGS84")
lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
lyr.styles.append('My Style')
m.layers.append(lyr)
m.zoom_to_box(lyr.envelope())
mapnik.render_to_file(m,i, 'png')
print "Listo"
I get the next error:
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import imagen_shp
Traceback (most recent call last):
  File "", line 1, in 
  File "imagen_shp.py", line 32, in 
lyr.datasource = mapnik.Shapefile(base=filepath, file=filepath)
  File "C:\mapnik-0.7.1\python\2.6\site-packages\mapnik\__init__.py", line
282,
in Shapefile
return CreateDatasource(keywords)
RuntimeError: C:\Ýndice.shp/C:\Ýndice does not exist
>>>
I also reviewed the line which causes the error, it's a script from the
mapnik library:
def Shapefile(**keywords):
"""Create a Shapefile Datasource.
Required keyword arguments:
  file -- path to shapefile without extension
Optional keyword arguments:
  base -- path prefix (default None)
  encoding -- file encoding (default 'utf-8')
>>> from mapnik import Shapefile, Layer
>>> shp = Shapefile(base='/home/mapnik/data',file='world_borders')
>>> lyr = Layer('Shapefile Layer')
>>> lyr.datasource = shp
  """
keywords['type'] = 'shape'
return CreateDatasource(keywords)
Does anyone could help me?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor