QGIS Python Scripting permission denied

المشرف العام

Administrator
طاقم الإدارة
I've just started a Python Scripting tutorial on QGIS. The problem arrives right at the end, when I have to use this script:

output_file = open('c:/Users/Ujaval/Desktop/airports.txt', 'w')for f in layer.getFeatures(): geom = f.geometry() line = '%s, %s, %f, %f\n' % (f['name'], f['iata_code'], geom.asPoint().y(), geom.asPoint().x()) unicode_line = line.encode('utf-8') output_file.write(unicode_line)output_file.close()Please note that the PATH used is another one, and that's my big problem as I tried several alternatives on how to write it, examples:

output_file = open('D:\ne_10m_airports', 'w')IOError: [Errno 22] invalid mode ('w') or filename: 'D:\ne_10m_airports'output_file = open('C://Users//Florin//Desktop//ne_10m_airports', 'w')IOError: [Errno 13] Permission denied: 'C://Users//Florin//Desktop//ne_10m_airports'output_file = open('C:/Users/Florin/Desktop/ne_10m_airports', 'w')output_file = open('C:\Users\Florin\Desktop\ne_10m_airports', 'w')I can't really seem to figure out why it's being denied permission. In any case, the error is either: permission denied, invalid mode or filename. (Tried it with double quotes as well).

In any case, is it me or QGIS Python scripting is more difficult than in ArcPy. I don't see the documentation as easy to read either or perhaps I'm looking in the wrong spot.

I'd really appreciate any help, thanks!



أكثر...
 
أعلى