[issue34874] Python 3.6.3 command script wrapped in single quotes produces NameError: name 'A' is not defined

2018-10-03 Thread Tim McDonough


Tim McDonough  added the comment:

Yes, there are wrapper scripts on my system.  My system was updated from 3.3 to 
3.6.  The 3.3 and 3.6 wrappers are equivalent and similar to the python2.7 
wrapper as shown:  

exec -a `dirname $realpath`/python2.7 `dirname $realpath`/python2.7.real "$@"
exec /usr/bin/scl enable python33 -- python "$@"
exec /usr/bin/scl enable rh-python36 -- python "$@"

This has to be something specific to the rh-python36 package or python36-scl 
that replaced python33 on my system.  Since Benjamin could not reproduce with 
3.6.3 my bet that it is an in-house, self-inflicted problem.

Thank you.  I am closing this one as "not a bug" in python 3.6.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34874] Python 3.6.3 command script wrapped in single quotes produces NameError: name 'A' is not defined

2018-10-03 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

@Tim Is it possible that 'python3' in your command refers to some wrapper which 
forwards its arguments to real Python in a wrong way?

--
nosy: +izbyshev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34874] Python 3.6.3 command script wrapped in single quotes produces NameError: name 'A' is not defined

2018-10-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I can reproduce this problem when use double quotes as both outer and internal 
quotes.

$ echo -n '{"A":"a"}' | python3 -c "import sys,json; j=json.load(sys.stdin); 
print(j["A"])"
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'A' is not defined

This has not relation to Python, this is how the quoting in the shell works. 
Perhaps something in your configuration makes single quotes be interpreted as 
double quotes.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34874] Python 3.6.3 command script wrapped in single quotes produces NameError: name 'A' is not defined

2018-10-02 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

I cannot reproduce this problem with exactly Python 3.6.3. This may be some 
strange situation specific to your configuration, which should be supported to 
RedHat.

--
nosy: +benjamin.peterson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34874] Python 3.6.3 command script wrapped in single quotes produces NameError: name 'A' is not defined

2018-10-02 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34874] Python 3.6.3 command script wrapped in single quotes produces NameError: name 'A' is not defined

2018-10-02 Thread Tim McDonough


New submission from Tim McDonough :

I found an odd behavior that seems to be limited to Python 3.6.3. 
Python 3.6.3 command scripts seem to prefer wrapping in double quotes instead 
of single quotes.

Here is an example of the error.  

$ echo -n '{"A":"a"}' | python3 -c 'import sys,json; j=json.load(sys.stdin); 
print(j["A"])'
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'A' is not defined

# Swapping single and double quotes works as expected.
#
$ echo -n '{"A":"a"}' | python3 -c "import sys,json; j=json.load(sys.stdin); 
print(j['A'])"
a

# Executing the original, failing script against python 2.6.6 works.
#
$ echo -n '{"A":"a"}' | python2 -c 'import sys,json; j=json.load(sys.stdin); 
print(j["A"])'
a

The failing environment is:
$ bash --version
GNU bash, version 4.1.2(2)-release (x86_64-redhat-linux-gnu)
$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)

These python versions also seem to work fine: 2.6.6, 2.7.9, 3.5.1, and 3.5.2.
Assigning the script to an environment variable follows the single/double quote 
issue. For example, this fails:

$ export python_script='import sys,json; j=json.load(sys.stdin); print(j["A"])'
$ echo -n '{"A": "a"}' | python3 -c "${python_script}"

This would be a good unit test candidate if not already present.

--
components: Tests
messages: 326916
nosy: Tim McDonough
priority: normal
severity: normal
status: open
title: Python 3.6.3 command script wrapped in single quotes produces NameError: 
name 'A' is not defined
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com