importing
vincent wehren
vincent at visualtrans.de
Sun Jan 4 10:08:43 EST 2004
"vincent wehren" <vincent at visualtrans.de> schrieb im Newsbeitrag
news:bt9a52$nug$1 at news4.tilbu1.nb.home.nl...
| "Boomer" <boomer4467 at yahoo.com> schrieb im Newsbeitrag
| news:231bc96c.0401031249.12cff6d7 at posting.google.com...
| | Hi all,
| | I'm new to python which explains my problems with this. I'm trying
| | to import a .csv file(from excel) into some fields on my company's
| | software system(which interfaces to an sql database. Each row in this
| | .csv file needs to be split into smaller strings and each respective
| | string applied to it's field in the software then it's saved and the
| | next row starts, here's the code I've come up with so far.
| |
| | f=open ("book1.csv", "r")
| | s=f.readline ()
| | while s != "":
| | print s
| | l = s.split(s,",",(11))
| | PlayIt.SetFieldContent ("SY012M1", "art-nr", l[0])
| | PlayIt.PlayContent ("{CSB SY012M1|art-nr}{Enter}")
| | PlayIt.SetFieldContent ("SY012ADM1", "001bez", l[1])
| | PlayIt.SetFieldContent ("SY012ADM1", "005agr", l[2])
| | PlayIt.SetFieldContent ("SY012ADM1", "006agr", l[3])
| | PlayIt.SetFieldContent ("SY012ADM1", "009kst", l[4])
| | PlayIt.SetFieldContent ("SY012EHM1", "005laeh", l[5])
| | PlayIt.SetFieldContent ("SY012EHM1", "006lauf", l[6])
| | PlayIt.SetFieldContent ("SY012EHM1", "011vkuf", l[7])
| | PlayIt.SetFieldContent ("SY012SDM1", "012fest", l[8])
| | PlayIt.SetFieldContent ("SY012PRM1", "001tpr", l[9])
| | PlayIt.SetFieldContent ("SY012PRM1", "002wpr", l[10])
| | PlayIt.SetFieldContent ("SY012PRM1", "003plpr", l[11])
| | PlayIt.PlayContent ("{CSB SY012M1|art-nr}{F2}")
| | s=f.readline ()
| | f.close ()
| |
| | here's the error
| |
| | Traceback (innermost last):
| | File "<string>", line 5, in ?
| | AttributeError: 'string' object has no attribute 'split'
| |
| | the furthest I get is when I remove the s.split all together then I
| | can actually watch it import the first field correctly and switch
| | focus to the second field where it prints a comma and then hangs and
| | eventually gives the
| | argument 3: expected string list found
| | Someone told me I need to import the string module using "import
| | string" somewhere in my code, but when I do this I get an error
| | stating that no such module exists. I run this as script inside a
| | macro from another program and I believe the version of python this
| | program uses is 2.2.1.
|
| Hi "Boomer"
|
| if you are using version V3.91 or lower of your companies software, the
| embedded Python will still be at 1.52. If it is V4.20 it'll be Python
2.2.2.
| Since I know that the Python standard library is not shipped with the
| software you are referring to, you need to either install Python (in the
| version corresponding to your version) on your local machine, or an
| accessible share and set your environment properly.
|
| Looking at your example I am pretty confident that your are using V391
which
| embedds 1.52. As a quick fix: check if either "string.pyc" or "string.py"
| lives in your w32 directory or - if you are executing via
Just for the record, I mean the w32 directory of the ERP system you are
referring to!
Vincent Wehren
a .pli file - in
| the directory "playit.exe" lives in. If that is not the case, get either
| module in the correct version and copy it to the directories just
described.
| This will fix your problem (until you try to import another module
| ofcourse).
|
| HTH
|
| Vincent Wehren
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
| | Does anyone have any ideas? Any help would be wonderful!!!
|
|
More information about the Python-list
mailing list