[issue34627] Python incorrect execution order

2018-09-11 Thread badrussians


badrussians  added the comment:

Big Sorry - it is my mistake. In terminal I execute same file, but in other 
location.

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

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



[issue34627] Python incorrect execution order

2018-09-11 Thread badrussians

New submission from badrussians :

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
print('');
import sys, os, subprocess, re, ctypes, tempfile, shutil, tarfile, 
urllib.request;
argsCount=len(sys.argv);
scriptDir = os.path.dirname(os.path.abspath(sys.argv[0]));


def FindFullPaths(strPattern, *orderedSearchDirs, \
  findFile=True, findDir=False, \
  ignoreCase=False, returnFirst=True):
print('#  FindFullPaths__In');
result = [];
def resultAppendUnique(item):
if item not in result:
result.append(item);
pattern = re.compile(strPattern, \
re.IGNORECASE | re.DOTALL if ignoreCase else re.DOTALL);
isFound = False;
for searchDir in orderedSearchDirs:
print('#searchDir', searchDir, orderedSearchDirs, '\n');
for leafName in os.listdir(searchDir):
leafPath = os.path.join(searchDir, leafName);
isDir = os.path.isdir(leafPath);
isFound = (findDir and isDir or \
   findFile and 
os.path.isfile(leafPath)) \
and pattern.search(leafName) is 
not None;
print('#leafPath:', leafPath, '\n'); #ERROR = output 
Last AND last time - no in output!
print('#isFound:', isFound); #ERROR = output 
First AND first time - no in output!
if isFound:
resultAppendUnique(leafPath);
if isDir and not (returnFirst and isFound):
for partLeafPath in FindFullPaths(strPattern, 
leafPath, \
findFile=findFile, 
findDir=findDir, \
ignoreCase=ignoreCase, 
returnFirst=returnFirst):
resultAppendUnique(partLeafPath);
isFound = True;
if returnFirst and isFound:
break;
if returnFirst and isFound:
break;
print('#  FindFullPaths__Return');
return result; 

FindFullPaths('^bat$', '/home/user/Рабочий стол/ttt');
print(sys.version);

 OUTPUT: 
'/home/user/Рабочий стол/test2.py' 

#  FindFullPaths__In
#searchDir /home/user/Рабочий стол/ttt ('/home/user/Рабочий стол/ttt',) 

#leafPath: /home/user/Рабочий стол/ttt/BackupRestore.py 

#isFound: False
#leafPath: /home/user/Рабочий стол/ttt/temp.py 

#isFound: False
#leafPath: /home/user/Рабочий стол/ttt/Create ISO.py 

#isFound: False
#  FindFullPaths__Return
3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0]
## Environment ##
Russian Ubuntu 18.04.1 and Kali 2018.3
PS: Ru:'/home/user/Рабочий стол' == Eng'/home/user/Desktop'

--
components: Interpreter Core
files: test2.py
messages: 324996
nosy: badrussians
priority: normal
severity: normal
status: open
title: Python incorrect execution order
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47795/test2.py

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