[issue40906] Unable to import module due to python unable to resolve dependecies

2020-06-11 Thread Saba Kauser


Saba Kauser  added the comment:

Thanks Steve!

--

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



[issue40906] Unable to import module due to python unable to resolve dependecies

2020-06-10 Thread Saba Kauser


Saba Kauser  added the comment:

Hello Steve,
You have added changes to load windows dependent DLLs for python C extension 
modules. After building the source, I can import the module only after I set 
dll path as:
os.add_dll_directory('C:\\Program Files\\IBM\\IBM DATA SERVER DRIVER_01\\bin') 

Is there a backward compatibility or any other way I can hardcode the 
dependency resolution path while building the extension itself.

I have read through the discussion in https://bugs.python.org/issue36085 but I 
don't seem to understand if there is a real way for users to import the module 
without any additional step like os.add_dll_directory() from python.

Thanks!

--

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



[issue40906] Unable to import module due to python unable to resolve dependecies

2020-06-09 Thread Saba Kauser


Saba Kauser  added the comment:

Thanks a ton! That worked..
As I understand, users are required to add the directory path of the dll.
Is there any way I can set this while building the extension with dependency? I 
basically want to hard-code the dependency path so that import module works 
fine without additional settings like you mentioned.

Thank you!

--

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



[issue40906] Unable to import module due to python unable to resolve dependecies

2020-06-07 Thread Saba Kauser


Change by Saba Kauser :


Added file: https://bugs.python.org/file49222/python3.8_2.png

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



[issue40906] Unable to import module due to python unable to resolve dependecies

2020-06-07 Thread Saba Kauser


Change by Saba Kauser :


Added file: https://bugs.python.org/file49221/python3.7.png

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



[issue40906] Unable to import module due to python unable to resolve dependecies

2020-06-07 Thread Saba Kauser


New submission from Saba Kauser :

Hi,
I am building python ibm_db C extension for Python 3.8 support. while the 
binary is generated successfully and installed to site-packages, I am unable to 
load the same.
The error I get is:

Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ibm_db
Traceback (most recent call last):
  File "", line 1, in 
ImportError: DLL load failed while importing ibm_db: The specified module could 
not be found.
>>> quit()

I have correctly set PATH and LIB to point to python installation. I have also 
updated LIB to point to correct runtime dependencies. 
Seeing through procmon, python is unable to resolve the runtime lib dependency 
path from PATH. The same steps work just fine for python 3.7 and other 
versions. This problem is only seen on windows. Linux and MAC works fine.

I am attaching the process monitor snippets for python 3.8(failing case) as 
well as python (3.7) success case.

Can you kindly look into it and share insights on what could lead to this 
problem and any possible resolution/s that are currently available. I tried 
with python 3.8.2 as same problem there as well.

Attached are the procmon logs for python 3.7(success case) and python 
3.8(failing case).

python 3.7 : python3.7.log
python 3.8 : python3.8_1.log , python3.8_2.log

--
components: Installation
files: python3.8_1.png
messages: 370964
nosy: sabakauser
priority: normal
severity: normal
status: open
title: Unable to import module due to python unable to resolve dependecies
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49220/python3.8_1.png

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



[issue37541] get_python_lib() returns incorrect path for site-packages

2019-07-10 Thread Saba Kauser


New submission from Saba Kauser :

HI,
I am using get_python_lib() to copy certain data files to site-pacakges 
location while installation of package ibm_db. I am using this function to 
execute a command as well on one of the shared library @package install 
location.
So far, I have faced issue with this function in:
virtual env, anaconda python and with pip cache enabled. 

The source can be found at: 
https://github.com/ibmdb/python-ibmdb/blob/master/IBM_DB/ibm_db/setup.py#L242

When I run through debugger for python setup.py build command, I can see 
following:
(Pdb) p data_files
[('C:\\Users\\skauser\\Anaconda\\Lib\\site-packages', ['./README.md']), 
('C:\\Users\\skauser\\Anaconda\\Lib\\site-packages', ['./CHANGES']), 
('C:\\Users\\skauser\\Anaconda\\Lib\\site-packages', ['./LICENSE']), 
('C:\\Users\\skauser\\Anaconda\\Lib\\site-packages', ['./config.py.sample'])]

However, in "python setup.py install", this folder structure is created:
C:\Users\skauser\Anaconda\Lib\site-packages\users\skauser\appdata\local\programs\python\python37\Lib
 and no data files are copied.

If I do : "pip install ." from source directory,
The data_files are copied under 
"c:\users\skauser\anaconda\lib\site-packages\users\skauser\anaconda\lib\site-packages"
 when the expectation is to have the files copied under 
"c:\users\skauser\anaconda\lib\site-packages".

Can you please look into this. 
Although this is not a serious problem for platforms other than mac, But on 
MAC, I am using this same function get_python_lib()to execute a system command 
and without this working properly, MAC users are unable to use the python 
ibm_db driver.

This is blocking! Please help.

--
components: Distutils
messages: 347612
nosy: dstufft, eric.araujo, sabakauser
priority: normal
severity: normal
status: open
title: get_python_lib() returns incorrect path for site-packages
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

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



[issue36640] distutils.sysconfig.get_python_lib behaves incorrectly when pip cache is enabled

2019-04-25 Thread Saba Kauser


Saba Kauser  added the comment:

Experts, please help.
get_python_lib() is behaving strangely and I have detailed the problem in my 
last update.

--
title: python ibm_db setup.py post install script does not seem to work from 
Anaconda -> distutils.sysconfig.get_python_lib behaves incorrectly when pip 
cache is enabled

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



[issue36640] python ibm_db setup.py post install script does not seem to work from Anaconda

2019-04-25 Thread Saba Kauser


Change by Saba Kauser :


--
components: +Distutils -Build
nosy: +dstufft, eric.araujo

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



[issue36640] python ibm_db setup.py post install script does not seem to work from Anaconda

2019-04-21 Thread Saba Kauser


Saba Kauser  added the comment:

I have debugged this further.
The problem seems be happening due to usage of get_python_lib().

e.g:
if('darwin' in sys.platform):
class PostInstall(install):
""" Post installation - run install_name_tool on Darwin """
def run(self):
install.run(self)
clipath = os.getenv('IBM_DB_HOME', '@loader_path/clidriver')
print("in PostInstall with {}".format(clipath))
for so in glob.glob(get_python_lib()+r'/ibm_db*.so'):
os.system("install_name_tool -change libdb2.dylib 
{}/lib/libdb2.dylib {}".format(clipath, so))

cmd_class = dict(install = PostInstall)

The get_python_lib() returns following path and hence my script is never able 
to fetch the matching lib name.
example output of get_python_lib() usage:

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Users/skauser/anaconda3/lib/python3.7/site-packages/CHANGES

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Users/skauser/anaconda3/lib/python3.7/site-packages/LICENSE

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Users/skauser/anaconda3/lib/python3.7/site-packages/README.md

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Users/skauser/anaconda3/lib/python3.7/site-packages/config.py.sample


I have both anaconda and standalone python installations and get_python_lib() 
seem to get confused with different paths.
It sometimes returns the duplicate path as well:
e.g: 

/Users/skauser/anaconda3/lib/python3.7/site-packages/Users/skauser/anaconda3/lib/python3.7/site-packages/CHANGES

/Users/skauser/anaconda3/lib/python3.7/site-packages/Users/skauser/anaconda3/lib/python3.7/site-packages/LICENSE

/Users/skauser/anaconda3/lib/python3.7/site-packages/Users/skauser/anaconda3/lib/python3.7/site-packages/README.md

/Users/skauser/anaconda3/lib/python3.7/site-packages/Users/skauser/anaconda3/lib/python3.7/site-packages/config.py.sample

Above examples are taken from one usage of get_python_lib() for copying certain 
data files while installation to site-packages. 
My strong belief is that, its the same problem with the post-install script as 
well.

Why is get_python_lib() behavior not consistent? 
What are the other alternatives to get the current site-package path for the 
running installation?

When I disable cache of pip and install, get_python_lib() path as retrieved 
while install behaves correctly.
e.g: pip --no-cache-dir install ibm_db

Kindly help! This is blocking production of many users.

--

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



[issue36640] python ibm_db setup.py post install script does not seem to work from Anaconda

2019-04-18 Thread Saba Kauser


Saba Kauser  added the comment:

I was able to determine the reason. 
When running through anaconda, the pip copies ibm_db.so to site-packages path. 
However, as logged in user, install_name_tool fails with permission denied 
error.

BLR-D-MACOS03:site-packages skauser$ install_name_tool -change 
@loader_path/clidriver/lib/libdb2.dylib libdb2.dylib 
ibm_db.cpython-37m-darwin.so
error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: can't 
open input file: ibm_db.cpython-37m-darwin.so for writing (Permission denied)
error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: can't 
lseek to offset: 0 in file: ibm_db.cpython-37m-darwin.so for writing (Bad file 
descriptor)
error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: can't 
write new headers in file: ibm_db.cpython-37m-darwin.so (Bad file descriptor)
error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: can't 
close written on input file: ibm_db.cpython-37m-darwin.so (Bad file descriptor)
BLR-D-MACOS03:site-packages skauser$ sudo install_name_tool -change 
@loader_path/clidriver/lib/libdb2.dylib libdb2.dylib 
ibm_db.cpython-37m-darwin.so

Even if i do "sudo pip install ibm_db", although the package is copied to 
site-packages, install_name_tool fails with error.
However, if build the source via pip as :

cd  /Users/skauser/python-ibmdb/IBM_DB/ibm_db
sudo pip install .

install_name_tool is able to execute on ibm_db*.so.

Do you have any idea why would the permission problem occur only if I do pip 
install from pypi and not from source?

--

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



[issue36640] python ibm_db setup.py post install script does not seem to work from Anaconda

2019-04-16 Thread Saba Kauser


Saba Kauser  added the comment:

Thanks Karthikeyan.

The behavior is specific to anaconda when I use the python/pip that comes with 
it. When I use the pip from anaconda, 
e.g:/Users/skauser/anaconda3/bin/pip

pip install ibm_db
Installation is success,but when I import ibm_db, I get this error

import ibm_db
>>> import ibm_db
Traceback (most recent call last):
  File "", line 1, in 
ImportError: 
dlopen(/Users/skauser/anaconda3/lib/python3.7/site-packages/ibm_db.cpython-37m-darwin.so,
 2): Library not loaded: libdb2.dylib
  Referenced from: 
/Users/skauser/anaconda3/lib/python3.7/site-packages/ibm_db.cpython-37m-darwin.so
  Reason: image not found

Reason being, the post install script of my setup.py is not executed and hence 
following command did not run post install .

for so in glob.glob(get_python_lib()+r'/ibm_db*.so'):
os.system("install_name_tool -change libdb2.dylib {}/lib/libdb2.dylib 
{}".format(clipath, so))

Can be seen at 
https://github.com/ibmdb/python-ibmdb/blob/master/IBM_DB/ibm_db/setup.py#L58

However, when I use the standalone python installation that is outside of 
anaconda distribution, pip install correctly runs the post install script 
ibm_db's setup.py.

/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 03:13:28)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ibm_db
>>

The error Reason: image not found is specific to MAC due to its security 
setting and I have added a workaround that is expected to work with pip 
install. However, it does not seem to work.

--

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



[issue36640] python ibm_db setup.py post install script does not seem to work from Anaconda

2019-04-16 Thread Saba Kauser


New submission from Saba Kauser :

Hi,
I have added a post install class that's working fine when I do "pip install 
ibm_db" on MAC. However, when I use the python/pip from anaconda3(python 3.7), 
the same pip is not executing the post install script.
Can some one please take a look at assist.
The class can be seen at:
https://github.com/ibmdb/python-ibmdb/blob/master/IBM_DB/ibm_db/setup.py#L52

Post install, I am expecting following output:
BLR-D-MACOS03:site-packages skauser$ otool -L ibm_db.cpython-37m-darwin.so
ibm_db.cpython-37m-darwin.so:
@loader_path/clidriver/lib/libdb2.dylib (compatibility version 0.0.0, 
current version 0.0.0)

When executing from Anaconda, the name of libdb2.dylib is unchanged.

I would also like to know how can I verbose the print/log statements of my 
setup.py via pip  install.

--
components: Build
messages: 340324
nosy: sabakauser
priority: normal
severity: normal
status: open
title: python ibm_db setup.py post install script does not seem to work from 
Anaconda
type: behavior
versions: Python 3.7

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



[issue36269] post install in setup.py does not work when executed through pip

2019-03-13 Thread Saba Kauser


Change by Saba Kauser :


--
stage:  -> resolved
status: open -> closed

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



[issue36269] post install in setup.py does not work when executed through pip

2019-03-13 Thread Saba Kauser


Saba Kauser  added the comment:

I am able to get this to work.
I just needed to invoke parent's run prior to the post install commands.

if('darwin' in sys.platform):
class PostInstall(install):
""" Post installation - run install_name_tool on Darwin """
def run(self):
install.run(self)
clipath = os.getenv('IBM_DB_HOME', '@loader_path/clidriver')
print("in PostInstall with {}".format(clipath))
for so in glob.glob(r'build/lib*/ibm_db*.so'):
os.system("install_name_tool -change libdb2.dylib 
{}/lib/libdb2.dylib {}".format(clipath, so))

cmd_class = dict(install = PostInstall)

--
resolution:  -> fixed

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



[issue36269] post install in setup.py does not work when executed through pip

2019-03-12 Thread Saba Kauser


New submission from Saba Kauser :

Hello,

I have a post install class that looks like this:
if('darwin' in sys.platform):
class PostInstall(install):
""" Post installation - run install_name_tool on Darwin """
def run(self):
clipath = os.getenv('IBM_DB_HOME', '@loader_path/clidriver')
print("in PostInstall with {}".format(clipath))
for so in glob.glob(r'build/lib*/ibm_db*.so'):
os.system("install_name_tool -change libdb2.dylib 
{}/lib/libdb2.dylib {}".format(clipath, so))
install.run(self)
cmd_class = dict(install = PostInstall)


And I pass cmd_class to setup(..) as:
setup(..
  include_package_data = True,
   cmdclass = cmd_class,
   **extra
 )

When I execute setup.py as "python setup.py install", then the PostInstall 
operation is executed after the ibm_db.so is built and installed and I see the 
intended result. 
However, when I run "pip install ibm_db" or "pip install .",
the execution order looks like this:
warnings.warn(notifyString)
running install
in PostInstall with /Applications/dsdriver/  ==> this is my post install 
script
running build
running build_py
creating build  
creating build/lib.macosx-10.9-x86_64-3.7==> I need to traverse to this 
folder to find my shared library

I would expect it to be run post the ibm_db is installed, not before it gets 
built. 

Can you please let me know how can this be fixed. Is this a bug with pip?

--
components: Build
messages: 337736
nosy: sabakauser
priority: normal
severity: normal
status: open
title: post install in setup.py does not work when executed through pip
type: behavior
versions: Python 3.7

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



[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-02-28 Thread Saba Kauser


Saba Kauser  added the comment:

Thanks  Karthikeyan!

--

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



[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-02-28 Thread Saba Kauser


Saba Kauser  added the comment:

Could you please share the URL

--

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



[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-02-25 Thread Saba Kauser


Saba Kauser  added the comment:

Did anyone get a chance to look at my case?

Thanks,
Saba.

--

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



[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-02-22 Thread Saba Kauser


New submission from Saba Kauser :

Hi,
I am building my python ibm_db driver on python 3.7 using the setup.py under 
https://github.com/SabaKauser/python-ibmdb/blob/master/IBM_DB/ibm_db/setup.py 
with 2to3 compatibility as:

python setup.py build
and installing as:
python setup.py install

I have a python script that after installing has new empty line added for every 
line.

e.g:
my source:
   if database is None:
raise InterfaceError("createdb expects a not None database name value")
if (not isinstance(database, basestring)) | \
   (not isinstance(codeset, basestring)) | \
   (not isinstance(mode, basestring)):
raise InterfaceError("Arguments sould be string or unicode")

The generated file under 
C:\Users\skauser\AppData\Local\Programs\Python\Python37\Lib\site-packages\ibm_db-2.0.9-py3.7-win-amd64.egg\ibm_db_dbi.py

   if database is None:

raise InterfaceError("createdb expects a not None database name value")

if (not isinstance(database, str)) | \

   (not isinstance(codeset, str)) | \

   (not isinstance(mode, str)):

raise InterfaceError("Arguments sould be string or unicode")

As you can see, there is this new line that is throwing runtime error.
  File 
"c:\users\skauser\appdata\local\programs\python\python37\lib\site-packages\ibm_db-2.0.9-py3.7-win-amd64.egg\ibm_db_dbi.py",
 line 846

^
SyntaxError: invalid syntax

Could you please let me know how can I get rid of this behavior?

When I install the package using pip, I don't see this behavior.

Thanks!
Saba.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 336288
nosy: sabakauser
priority: normal
severity: normal
status: open
title: python 2to3 conversion tool is generating file with extra line for every 
input line
type: compile error
versions: Python 3.7

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



[issue34304] clarification on escaping \d in regular expressions

2018-07-31 Thread Saba Kauser


New submission from Saba Kauser :

Hello,

I have a program that works well upto python 3.6 but fails with python 3.7.

import re

pattern="DBMS_NAME: string(%d) %s"
sym = ['\[','\]','\(','\)']
for chr in sym:
  pattern = re.sub(chr, '\\' + chr, pattern)
  print(pattern)
  
pattern=re.sub('%s','.*?',pattern)
print(pattern)
pattern = re.sub('%d', '\\d+', pattern) 
print(pattern)
result=re.match(pattern, "DBMS_NAME: string(8) \"DB2/NT64\" ")
print(result)
result=re.match("DBMS_NAME python4: string\(\d+\) .*?", "DBMS_NAME python4: 
string(8) \"DB2/NT64\" ")
print(result)

expected output:
DBMS_NAME: string(%d) %s
DBMS_NAME: string(%d) %s
DBMS_NAME: string\(%d) %s
DBMS_NAME: string\(%d\) %s
DBMS_NAME: string\(%d\) .*?
DBMS_NAME: string\(\d+\) .*?



However, the below statement execution fails with python 3.7:
pattern = re.sub('%d', '\\d+', pattern) 

DBMS_NAME: string(%d) %s
DBMS_NAME: string(%d) %s
DBMS_NAME: string\(%d) %s
DBMS_NAME: string\(%d\) %s
DBMS_NAME: string\(%d\) .*?
Traceback (most recent call last):
  File 
"c:\users\skauser\appdata\local\programs\python\python37\lib\sre_parse.py", 
line 1021, in parse_template
this = chr(ESCAPES[this][1])
KeyError: '\\d'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pattern.txt", line 11, in 
pattern = re.sub('%d', '\\d+', pattern)
  File "c:\users\skauser\appdata\local\programs\python\python37\lib\re.py", 
line 192, in sub
return _compile(pattern, flags).sub(repl, string, count)
  File "c:\users\skauser\appdata\local\programs\python\python37\lib\re.py", 
line 309, in _subx
template = _compile_repl(template, pattern)
  File "c:\users\skauser\appdata\local\programs\python\python37\lib\re.py", 
line 300, in _compile_repl
return sre_parse.parse_template(repl, pattern)
  File 
"c:\users\skauser\appdata\local\programs\python\python37\lib\sre_parse.py", 
line 1024, in parse_template
raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \d at position 0

if I change the statement to have 3 backslash like 
pattern = re.sub('%d', '\\\d+', pattern) 

I can correctly generate correct regular expression.

Can you please comment if this has changed in python 3.7 and we need to escape 
'd' in '\d' as well ?

Thank you!

--
components: Regular Expressions
messages: 322842
nosy: ezio.melotti, mrabarnett, sabakauser
priority: normal
severity: normal
status: open
title: clarification on escaping \d in regular expressions
type: behavior
versions: Python 3.7

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



[issue33994] python build egg fails with error while compiling test cases

2018-06-28 Thread Saba Kauser


New submission from Saba Kauser :

Hello,
Everything was working perfectly until recently, may be a week back, when I 
first started to see the error while generating egg for python ibm_db package.
Every time I execute the command : python setup.py bdsit_egg, 
my flow stops with below error:

byte-compiling 
build\bdist.win-amd64\egg\tests\test_131_PrepareExecuteSelectStatementParams.py 
to test_131_PrepareExecuteSelectStatementParams.cpython-36.pyc
error: [Errno 2] No such file or directory: 
'build\\bdist.win-amd64\\egg\\tests\\__pycache__\\test_131_PrepareExecuteSelectStatementParams.cpython-36.pyc.1942660169328'
Please note that, every time I run, the file name is getting appended with a 
random number. e.g 
test_131_PrepareExecuteSelectStatementParams.cpython-36.pyc.1942660169328' when 
the file name placed under tests/__pycache__ should be 
test_131_PrepareExecuteSelectStatementParams.cpython-36.pyc.

There are however other test cases upto test_130* that are getting compiled 
correctly. 
e.g:
byte-compiling 
build\bdist.win-amd64\egg\tests\test_112_FieldNumDiffCaseColNames.py to 
test_112_FieldNumDiffCaseColNames.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_113_DateTest.py to 
test_113_DateTest.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_114_NumericTest_01.py to 
test_114_NumericTest_01.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_115_NumericTest_02.py to 
test_115_NumericTest_02.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_116_ConnActive.py to 
test_116_ConnActive.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_120_FieldName.py to 
test_120_FieldName.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_121_FieldNameAddCol.py to 
test_121_FieldNameAddCol.cpython-36.pyc
byte-compiling 
build\bdist.win-amd64\egg\tests\test_122_FieldNameDiffCaseColNames.py to 
test_122_FieldNameDiffCaseColNames.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_123_FieldNamePos_01.py to 
test_123_FieldNamePos_01.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_124_FieldNamePos_02.py to 
test_124_FieldNamePos_02.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_125_FieldNamePos_03.py to 
test_125_FieldNamePos_03.cpython-36.pyc
byte-compiling 
build\bdist.win-amd64\egg\tests\test_130_PrepExecuteSelectStmt.py to 
test_130_PrepExecuteSelectStmt.cpython-36.pyc

Can you guide me on what is leading to this? What is making to have the file 
name appended with random number.

Appreciate your assitance!

Thank you,
Saba.

--
components: Build
messages: 320700
nosy: sabakauser
priority: normal
severity: normal
status: open
title: python build egg fails with error while compiling test cases
type: compile error
versions: Python 3.6

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



[issue33704] python 3.7 and python 3.8 stable release

2018-05-30 Thread Saba Kauser


New submission from Saba Kauser :

Hi,
I am planning to make new release of python ibm_db driver and I wanted to know 
the stable versions of python beyond python 3.6.

I can see python 3.8 marked as "in development" and I do read that python 
3.7.0b4 is the final planned beta release preview. Would this mean that I 
cannot consider python 3.7 and python 3.8 for my next release and I would build 
only when these are marked stable.

Thank you!
Saba.

--
components: Build
messages: 318242
nosy: sabakauser
priority: normal
severity: normal
status: open
title: python 3.7 and python 3.8 stable release
type: behavior
versions: Python 3.7, Python 3.8

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



[issue32527] windows 7 python 3.6 : after some security updates, import ibm_db fails

2018-01-10 Thread Saba Kauser

New submission from Saba Kauser :

Hello,
I have a user who is complaining that python ibm_db module import fails after 
some windows 7 security update. I am not sure if this is a bug or some other 
setup issue but I could not find any other forum where I can post this query. 
Please feel free to point me to correct forum if this is not the correct place.

The error as reported by him is available here : 
https://github.com/ibmdb/python-ibmdb/issues/294#issuecomment-356254726

When run through pdb, the stack shows this:
C:\Users\IBM_ADMIN\Documents\Python>python -m pdb "test DB2 connection.py"
> c:\users\ibm_admin\documents\python\test db2 connection.py(3)()
-> import ibm_db
(Pdb) continue
Traceback (most recent call last):
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", line 
1667, in main
pdb._runscript(mainpyfile)
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", line 
1548, in _runscript
self.run(statement)
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\bdb.py", line 
431, in run
exec(cmd, globals, locals)
  File "", line 1, in 
  File "c:\users\ibm_admin\documents\python\test db2 connection.py", line 3, in 

import ibm_db
SystemError:  returned NULL without setting an error
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> c:\users\ibm_admin\documents\python\test db2 connection.py(3)()
-> import ibm_db
(Pdb)

when 'cont' is used, the control reaches python ibm_db driver that should have 
happened without having to 'cont'.

c:\users\ibm_admin\documents\python\test db2 connection.py(2)()
-> import ibm_db
(Pdb) cont
Traceback (most recent call last):
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", 
line 1667, in main
pdb._runscript(mainpyfile)
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", 
line 1548, in _runscript
self.run(statement)
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\bdb.py", 
line 431, in run
exec(cmd, globals, locals)
File "", line 1, in
File "c:\users\ibm_admin\documents\python\test db2 connection.py", line 2, in
import ibm_db
SQLCODE=-30082][CLI Driver] SQL30082N Security processing failed with reason 
"15" ("PROCESSING FAILURE"). SQLSTATE=08001
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
c:\users\ibm_admin\documents\python\test db2 connection.py(2)()
-> import ibm_db
(Pdb) cont
Post mortem debugger finished. The test DB2 connection.py will be restarted
c:\users\ibm_admin\documents\python\test db2 connection.py(2)()
-> import ibm_db
(Pdb) cont
Traceback (most recent call last):
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", 
line 1667, in main
pdb._runscript(mainpyfile)
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", 
line 1548, in _runscript
self.run(statement)
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\bdb.py", 
line 431, in run
exec(cmd, globals, locals)
File "", line 1, in
File "c:\users\ibm_admin\documents\python\test db2 connection.py", line 2, in
import ibm_db
SQLCODE=-30082][CLI Driver] SQL30082N Security processing failed with reason 
"15" ("PROCESSING FAILURE"). SQLSTATE=08001
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
c:\users\ibm_admin\documents\python\test db2 connection.py(2)()
-> import ibm_db
(Pdb)


Please note that the script works fine when run as administrator and it fails 
only when run as non-admin user. non-admin user too was working fine until 
recently when some update was applied to windows OS and then it stopped working 
only for non-admin user. Python and ibm_db driver both have be uninstalled and 
re-installed for non-admin user, but no luck.
kindly help!

--
components: Windows
messages: 309764
nosy: paul.moore, sabakauser, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: windows 7 python 3.6 : after some security updates, import ibm_db fails
type: security
versions: Python 3.6

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