0

I have a problem with Python 2.6.6

when I try to run my code, I have this message:

Error - could not save file [Errno 22] invalid mode ('wb') or filename: ""

my file is called script2!

Then I forogt to mentionned that if I try to save my code after the error message popped up, i get the following error message

Traceback (most recent call last):
  File "C:\Python26\Lib\site-packages\pythonwin\pywin\framework\editor\document.py", line 77, in OnSaveDocument
    self.SaveFile(fileName)
  File "C:\Python26\Lib\site-packages\pythonwin\pywin\scintilla\document.py", line 54, in SaveFile
    ok = view.SaveTextFile(fileName)
  File "C:\Python26\Lib\site-packages\pythonwin\pywin\scintilla\view.py", line 394, in SaveTextFile
    doc._SaveTextToFile(self, f)
  File "C:\Python26\Lib\site-packages\pythonwin\pywin\scintilla\document.py", line 155, in _SaveTextToFile
    f.write(s.encode(source_encoding))
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u201c' in position 1638: ordinal not in range(256)
win32ui.error: OnSaveDocument() virtual handler (<bound method SyntEditDocument.OnSaveDocument of <pywin.framework.editor.color.coloreditor.SyntEditDocument instance at 0x033639E0>>) raised an exception

Thanks for you help

user1166251
  • 97
  • 1
  • 4
  • 15
  • This is a re-ask. please see this SO question page: http://stackoverflow.com/questions/3942888/unicodeencodeerror-latin-1-codec-cant-encode-character – Krishna Feb 20 '12 at 21:20
  • I don't see anything comparable with the page you attached? – user1166251 Feb 20 '12 at 21:28
  • 1
    You show two errors, how are they related? Is this from some editor you're using, or code you've written yourself? – Thomas K Feb 20 '12 at 21:41

0 Answers0