python -c text not correct |
Post Reply |
Author | |
edward22243
Major Contributor Joined: 19.Apr.2019 Points: 41 |
Post Options
Thanks(0)
Posted: 18.Sep.2019 at 14:07 |
This is my generator code: $e = __(external $str read) It is self-explanatory The result is that the program crashes: "Unhandled exceptions: Strings only store Characters" For some other text than a, I get for $e a string of some Chinese signs. How to continue? |
|
edward22243
Major Contributor Joined: 19.Apr.2019 Points: 41 |
Post Options
Thanks(0)
|
Goal was to generate a timestamp as such:
external 'python -c "from datetime import datetime; n = datetime.now(); print(n.strftime(''%d-%b-%H-%M-%S''));"' read and that also crashed, hence the investigation. |
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
The python command isn't using the expected encoding for a command-line command, hence why MetaEdit+ shows an error (it shouldn't actually crash though - it just shows the error and you can press Terminate).
See if there are any options in python to change the encoding to match the command line's Unicode "cmd /u" (UCS-2 le). E.g. https://stackoverflow.com/questions/492483/setting-the-correct-encoding-when-piping-stdout-in-python. If you can't figure it out on the Python side of things, you can simply have python write to a file with external...executeBlocking and then MetaEdit+ can read the file, specifying the encoding if necessary.
|
|
Post Reply | |
Tweet |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |