Skip to content

python 2to3 conversion tool is generating file with extra line for every input line #80256

Closed

Description

@SabaKauser
BPO 36075
Nosy @terryjreedy, @mdickinson, @SabaKauser, @tirkarthi
Superseder
  • bpo-34108: 2to3 munges new lines on Windows
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-10-08.14:54:16.716>
    created_at = <Date 2019-02-22.09:38:39.354>
    labels = ['3.7', 'build', 'expert-2to3']
    title = 'python 2to3 conversion tool is generating file with extra line for every input line'
    updated_at = <Date 2019-10-08.14:54:16.715>
    user = 'https://github.com/SabaKauser'

    bugs.python.org fields:

    activity = <Date 2019-10-08.14:54:16.715>
    actor = 'mark.dickinson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-10-08.14:54:16.716>
    closer = 'mark.dickinson'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2019-02-22.09:38:39.354>
    creator = 'sabakauser'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36075
    keywords = []
    message_count = 8.0
    messages = ['336288', '336599', '336888', '336889', '336891', '336896', '354214', '354217']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'mark.dickinson', 'sabakauser', 'xtreak']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '34108'
    type = 'compile error'
    url = 'https://bugs.python.org/issue36075'
    versions = ['Python 3.7']

    Activity

    1. SabaKauser commented on Feb 22, 2019

      SabaKausermannequin
      MannequinAuthor

      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.

    2. added
      3.7 (EOL)
      build
      on Feb 22, 2019
    3. SabaKauser commented on Feb 26, 2019

      SabaKausermannequin
      MannequinAuthor

      Did anyone get a chance to look at my case?

      Thanks,
      Saba.

    4. terryjreedy commented on Mar 1, 2019

      @terryjreedy
      Member

      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.

    5. SabaKauser commented on Mar 1, 2019

      SabaKausermannequin
      MannequinAuthor

      Could you please share the URL

    6. tirkarthi commented on Mar 1, 2019

      @tirkarthi
      Member

      @SabaKauser You can find python-list mailing list here : https://mail.python.org/mailman/listinfo/python-list

    7. SabaKauser commented on Mar 1, 2019

      SabaKausermannequin
      MannequinAuthor

      Thanks Karthikeyan!

    8. mdickinson commented on Oct 8, 2019

      @mdickinson
      Member

      Looks like a duplicate of bpo-34108

    9. mdickinson commented on Oct 8, 2019

      @mdickinson
      Member

      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.

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)buildtopic-2to3

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions