Closed perplexedfingers closed 8 years ago
I found this situation is actually quite complicated. Could we just fix pound signs in one quotation mark pairs(' ', " ")? It could be like
" hey ' # ' "
' hey " # " '
Hi,
Since Opy does'nt really parse your source, but rather uses regular expressions, the following syntax limitations hold:
The trick is to make # appear only at the start of a string literal. A general way to do that is splitting your string literals as follows:
print("test.here #hey")
should be written as become:
print("test.here ""#""hey")
actually printing the concatenation of three strings, namely:
"test.here ", "#" and "hey"
Or, with single quotes if you prefer them:
print('test.here ''#''hey')
(Note that there are no double quotes here, '' are two single quotes)
actually again printing the concatenation of three strings, namely:
'test.here ', '#' and 'hey'
Hope this helps.
Kind regards Jacques
It seems this is the easiest way to have jobs done. Thanks!
Glad that it worked for you!
In opy_config.txt, I stated my module name as you suggested, and I wrote a usage function that prints out the usage when any invalid parameter given, in which I state the module name again. However, while Opy obfuscates my script, the module name is reserved and this reservation makes the string ill-formed. Python gets error running the ill-formed obfuscated script.
Is this a bug, or an intended behavior?
--Update
becomes
and these are fine