On Sat, 28 Sep 2019 at 03:49, Stephen P. Molnar <s.mol...@sbcglobal.net> wrote: > On 09/27/2019 09:55 AM, Stephen P. Molnar wrote: > > On 09/27/2019 09:28 AM, Mats Wichmann wrote: > >> On 9/27/19 5:47 AM, Stephen P. Molnar wrote:
> >>> I am writing code to combine text files and I have encountered an > >>> error that I am having trouble solving. Google is no help. > >>> > >>> The code is: > >>> > >>> |#!/usr/bin/env python3# -*- coding: utf-8 -*-""" Created on Thu Sep > >>> 26 09:51:55 2019 @author: comp """importnumpy asnp NAME > >>> =input("Enter Molecule ID: ")NAME_IN =NAME+'_apo-1acl.RMSD'DATA > >>> =[]DATA =np.genfromtxt(NAME_IN,skip_header=8,dtype=None)| > >>> > >>> The text file is: > >>> > >>> |RMSD TABLE __________ > >>> _____________________________________________________________________ > >>> ||||||Rank|Sub-|Run|Binding|Cluster|Reference|Grep|Rank||Energy|RMSD > >>> |RMSD > >>> |Pattern_____|______|______|___________|_________|_________________|___________ > >>> 118-7.230.0093.07RANKING 129-6.791.3992.64RANKING > >>> 2116-7.180.0093.19RANKING 312-6.930.0093.38RANKING > >>> 3217-6.840.2393.45RANKING 4115-6.550.0091.83RANKING > >>> 427-6.340.3391.77RANKING 515-6.410.0093.05RANKING > >>> 613-6.360.0092.84RANKING 6210-6.280.4792.92RANKING > >>> 636-6.270.4392.82RANKING 6418-6.250.3292.88RANKING > >>> 6513-6.240.9692.75RANKING 661-6.240.8792.60RANKING > >>> 6714-6.210.5192.90RANKING 6811-6.140.9892.78RANKING > >>> 6920-6.110.7192.67RANKING 61019-6.011.3693.00RANKING > >>> 7112-6.300.0093.28RANKING 814-5.850.0092.97RANKING > >>> _______________________________________________________________________| > >>> > >>> and the error is: > >>> > >>> |runfile('/home/comp/Apps/Models/1-PhosphorusLigands/CombinedLigands/MOL/Docking/Results/RMSDTable/CombineRMSDFiles.py') > >>> Enter Molecule ID: 13-7 13-7_apo-1acl.RMSD Traceback (most recent > >>> call last): File > >>> "/home/comp/Apps/Models/1-PhosphorusLigands/CombinedLigands/MOL/Docking/Results/RMSDTable/CombineRMSDFiles.py", > >>> line 15, in <module> DATA = np.genfromtxt(NAME_IN, dtype=None, > >>> skip_header=8) File > >>> "/home/comp/Apps/Miniconda3/lib/python3.7/site-packages/numpy/lib/npyio.py", > >>> line 2075, in genfromtxt raise ValueError(errmsg) ValueError: Some > >>> errors were detected ! Line #29 (got 1 columns instead of 7)| > >>> > >>> At this point, I'm not even sure how to ask the question. > >>> > >> > >> your posting has come across mangled, seemingly spaces have been > >> stripped. But trying to disentangle it: > >> > >> "...pyio.py", line 2075, in genfromtxt > >> raise ValueError(errmsg) > >> ValueError: Some errors were detected ! Line #29 (got 1 columns > >> instead of 7)| > >> > >> and in your data you have lines which are clearly not seven columns. > >> You've done skip_header=8 and it doesn't look here that's eight lines > >> in the data pasted, but maybe that's due to whatever happened to the > >> pasted data between the source and the email. It looks at the very > >> least like you should use a skip_footer keyword as well since you > >> show a footer line. Beyond that it's really hard to tell as the data > >> portion of the table looks like it has no separators... > >> _______________________________________________ > >> Tutor maillist - tu...@python.org > >> To unsubscribe or change subscription options: > >> https://mail.python.org/mailman/listinfo/tutor > > > > Sorry about the mangled files. > > > > > > I put both the python script and the data file in my Dropbox account. > > Here are the URL's: > > > > https://www.dropbox.com/s/aattr8qnjwd8b8e/13-7a_apo-1acl.RMSD?dl=0 > > https://www.dropbox.com/s/aattr8qnjwd8b8e/13-7a_apo-1acl.RMSD?dl=0 > > > Oh, dear. Just noticed my mistake. > > Here are the correct URL's: > > Data\ File: > https://www.dropbox.com/s/aattr8qnjwd8b8e/13-7a_apo-1acl.RMSD?dl=0 > Python Script: > https://www.dropbox.com/s/ni3pk0342q7o0qz/CombineRMSDFiles.py?dl=0 I get the feeling that you don't put much effort into asking questions on the mailing lists that I see you on. Here you have: 1) somehow posted your question to Python Tutor <tu...@python.org>, but posted your followup message to <debian-u...@lists.debian.net> 2) somehow ignored the error message from python: ValueError: Some errors were detected ! Line #29 (got 1 columns instead of 7)| 3) somehow ignored the advice you were given on Python Tutor: > >> It looks at the very > >> least like you should use a skip_footer keyword as well since you > >> show a footer line I checked your dropbox data file at your corrected URL. Line 29 is a sequence of 71 underscore characters. Like Mats Wichmann replied, I think that would explain the error message "got 1 columns instead of 7", although I haven't bothered to test it.