Python Forum
Cant pass corect variables to python script in bash script
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
Reply
#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
Reply
#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
Reply
#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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need a script to replace an existing Python installation in a version-independent dir pstein 7 145 May-09-2026, 01:04 PM
Last Post: DeaD_EyE
  Merge Script Functionality in a Single Script gksharma 8 183 Feb-04-2026, 11:47 PM
Last Post: deanhystad
  Py script to APP on MAC tester_V 3 774 Dec-05-2025, 08:12 PM
Last Post: tester_V
  Trying to install the edk2-rk3399 code but the script fails due some python bug mariozio 2 1,918 Aug-17-2025, 10:25 PM
Last Post: mariozio
  Running script from remote to server invisiblemind 4 1,836 Mar-28-2025, 07:57 AM
Last Post: buran
  Insert command line in script lif 4 2,200 Mar-24-2025, 10:30 PM
Last Post: lif
  modifying a script mackconsult 1 1,128 Mar-17-2025, 04:13 PM
Last Post: snippsat
  help with a script that adds docstrings and type hints to other scripts rickbunk 1 1,894 Feb-24-2025, 05:12 AM
Last Post: from1991
  Detect if another copy of a script is running from within the script gw1500se 4 2,111 Jan-31-2025, 11:30 PM
Last Post: Skaperen
  pass arguments from bat file to pyhon script from application absolut 2 2,880 Jan-13-2025, 11:05 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020