Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Cant pass corect variables to python script in bash script
#1
Hi im not familiar with python, I have som strange problem.

I have a bash script for example test.sh:

#!/usr/bin/bash

/usr/bin/python3.4 /home/my/test.py "$1"



If I call script test.py directly from command line as /usr/bin/python3.4 /home/my/test.py "ťčšťčš" it works


If a call script test.sh from commandline: test.sh "ťčšťčš" it not works

if im using only English chars it works in argument.. problem is only with non-English chars.



How to debug this ? Please help..
Im think everythink is Unicode... so bash is Unicode friendly python 3 is too .. I have no idea where is the problem ... sorry for my English..

sorry my mistake... ist a bit complicated...


Runing bash script works...


I wish use that bash script in sieve filter... so sieve passing utf8 encoded variables to bash and bash passint it to python... with only english chars it is ok.. but passing non english is buggy it

please delete this thread
Quote
#2
I don't know for bash but it depends on the terminal emulator you are using. If it is not support utf-8, bash can't do anything.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Quote
#3
It depends on the encoding used in the bash script file. It should match the one defined in your locale. Issue the "locale" command. It will list several environment variables (the important one is LANG). The last element of these variables (after the dot) is the encoding used by default on your system. Make sure your editor uses it.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Quote
#4
Not sure, but I'm guessing the utf is the culprit. Just for chuckles, try copying the file
to one with an ASCII name like 'abc' and see if that will work
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Multimode imports fine as script but not after compiling into exe chesschaser 0 50 Yesterday, 01:28 PM
Last Post: chesschaser
  Execute DBCC CHECKDB from python script susja 1 63 Aug-12-2020, 02:09 AM
Last Post: susja
  Web Form to Python Script to Text File to zip file to web wfsteadman 1 172 Aug-09-2020, 02:12 PM
Last Post: snippsat
  Execute full script samuelbachorik 0 152 Aug-06-2020, 08:09 PM
Last Post: samuelbachorik
  How to run diskpart from python script obgocs 1 92 Aug-06-2020, 05:46 AM
Last Post: Gribouillis
  Learning Python with telnetlib. Script seems to stall John_Williamson 1 125 Jul-23-2020, 05:52 PM
Last Post: John_Williamson
  The script won't take voice input ShishirModi 2 105 Jul-21-2020, 05:56 AM
Last Post: ShishirModi
  run a health check script on cloud server through paramiko amritjsr 4 198 Jul-21-2020, 02:30 AM
Last Post: amritjsr
  How to create a Kibana Visualisation with python script? adzadz 0 92 Jul-20-2020, 06:41 AM
Last Post: adzadz
  Need help creating a simple script Nonameface 12 376 Jul-14-2020, 02:10 PM
Last Post: BitPythoner

Forum Jump:


Users browsing this thread: 1 Guest(s)