Bugs item #745398, was opened at 2003-05-29 07:54 Message generated for change (Comment added) made by kjohnbraduk You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104866&aid=745398&group_id=4866
Category: PSP Group: None Status: Closed Resolution: None Priority: 5 Submitted By: Christian Muirhead (wilberforce) Assigned to: Jason Hildebrand (jdhildeb) Summary: PSP compilation produces syntax error Initial Comment: When the .psp file is compiled to a .py servlet, the __orig_file__ value is inserted, but no quoting is done on the file path. On Windows, this can mean that the \s in the file path are interpreted as escape sequences, which could potentially be invalid, leading to a ValueError when the servlet is imported. Example: PSP file c:\xtian\webware\PSP\Examples\index.psp results in a .py servlet with the line __orig_file__ = 'c:\xtian\webware\PSP\Examples\index.psp' Since \x expects a two-digit hex number, \xti triggers a ValueError. A related problem can occur if the file has single-quotes in its path - the generated line would be __orig_file__ = 'c:\xtian's\webware\PSP\Examples\index.psp' which is a syntax error. Fix: In Webware/PSP/ParseEventHandler.py at line 277, change: self._writer.println("__orig_file__ = '%s'" % self._ctxt.getFullPspFileName()) to self._writer.println("__orig_file__ = %r" % self._ctxt.getFullPspFileName()) so that the %r format specifier correctly handles \ and ' quoting. Cheers! ---------------------------------------------------------------------- Comment By: John Bradbury (kjohnbraduk) Date: 2004-10-30 08:59 Message: Logged In: YES user_id=1149282 When I make this change I then get an error when trying to run the examples under windows. Does anyone else use webware with windows? File "D:\xitami\Webware-0.8.1\WebKit\Cache\PSP\_xitami_Webware_0_8_1_PSP_Examples_index_psp.py", line 7 __orig_file__ = ''D:\xitami\Webware-0.8.1\PSP\Examples\index.psp'' ^ SyntaxError: invalid syntax ---------------------------------------------------------------------- Comment By: Jason Hildebrand (jdhildeb) Date: 2003-06-10 08:54 Message: Logged In: YES user_id=173690 Thanks for the report. I've applied the fix to CVS. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104866&aid=745398&group_id=4866 ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ Webware-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-devel