classification
Title: python 2to3 conversion tool is generating file with extra line for every input line
Type: compile error Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: 2to3 munges new lines on Windows
View: 34108
Assigned To: Nosy List: mark.dickinson, sabakauser, terry.reedy, xtreak
Priority: normal Keywords:

Created on 2019-02-22 09:38 by sabakauser, last changed 2019-10-08 14:54 by mark.dickinson. This issue is now closed.

Messages (8)
msg336288 - (view) Author: Saba Kauser (sabakauser) Date: 2019-02-22 09:38
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.
msg336599 - (view) Author: Saba Kauser (sabakauser) Date: 2019-02-26 03:11
Did anyone get a chance to look at my case?

Thanks,
Saba.
msg336888 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-01 03:42
I suspect that this may not be a cpython issue, in which case, it should be closed here as 'not-a-bug'.  I suggest that you present this on python-list and ask 'where is the bug most likely to be?'  You should get more readers there.
msg336889 - (view) Author: Saba Kauser (sabakauser) Date: 2019-03-01 04:05
Could you please share the URL
msg336891 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-03-01 04:39
@sabakauser You can find python-list mailing list here : https://mail.python.org/mailman/listinfo/python-list
msg336896 - (view) Author: Saba Kauser (sabakauser) Date: 2019-03-01 05:52
Thanks  Karthikeyan!
msg354214 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2019-10-08 14:35
Looks like a duplicate of #34108
msg354217 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2019-10-08 14:54
Closing as duplicate.

@sabakauser: if you update to a recent Python 3.7 (anything more recent than 3.7.1 should be enough), you should find that this is fixed.
History
Date User Action Args
2019-10-08 14:54:16mark.dickinsonsetstatus: open -> closed
superseder: 2to3 munges new lines on Windows
messages: + msg354217

resolution: duplicate
stage: resolved
2019-10-08 14:35:36mark.dickinsonsetnosy: + mark.dickinson
messages: + msg354214
2019-03-01 05:52:29sabakausersetmessages: + msg336896
2019-03-01 04:39:16xtreaksetnosy: + xtreak
messages: + msg336891
2019-03-01 04:05:01sabakausersetmessages: + msg336889
2019-03-01 03:42:14terry.reedysetnosy: + terry.reedy
messages: + msg336888
2019-02-26 03:11:27sabakausersetmessages: + msg336599
2019-02-22 09:38:39sabakausercreate