Packages at Python.org

K

kirby.urner

With Microsoft abandoning Visual FoxPro come 2015, we have 100K
developers
jumping ship (rough guess), perhaps to dot NET, but not necessarily.**

This page is potentially getting a lot of hits (I'm not privy to the
analytics):

http://packages.python.org/dbf/

So how *do* you get source code from such a web place? I'm not
finding
a tar ball or installer. Sorry if I'm missing something obvious, like
a link
to Sourceforge.

Kirby


** Unconfirmed rumors about IronPython leave me blog searching
this afternoon. Still part of Codeplex?
 
C

Chris Rebert

With Microsoft abandoning Visual FoxPro come 2015, we have 100K
developers
jumping ship (rough guess), perhaps to dot NET, but not necessarily.**

This page is potentially getting a lot of hits (I'm not privy to the
analytics):

http://packages.python.org/dbf/

So how *do* you get source code from such a web place?

You don't; that's only a docs page. You instead want the index entry page:
http://pypi.python.org/pypi/dbf
which has nice obvious download links.

Cheers,
Chris
 
D

Dino Viehland

Kirby said:
** Unconfirmed rumors about IronPython leave me blog searching this
afternoon. Still part of Codeplex?

IronPython is still using CodePlex for bug tracking and posting releases but
active development is now on GitHub w/ a Mercurial mirror. Jeff's blog has
more info: http://jdhardy.blogspot.com/
 
K

kirby.urner

http://packages.python.org/dbf/

So how *do* you get source code from such a web place?  I'm not
finding
a tar ball or installer.  Sorry if I'm missing something obvious, like
a link
to Sourceforge.

Thanks to very quick replies with pointers to

http://pypi.python.org/pypi/dbf/

instead of to packages.python.org/dbf

So this packages.python.org subdomain is perhaps
unaware of its pypi.python.org competition, which
has a brighter and more open look and feel?

What's the story there I wonder?

Quite an archeology (reminds me of the Vaults of
Parnassus).

Thanks again, for restoring me to productivity
(was dead in the water for a minute there).

Kirby
 
C

Chris Rebert

Thanks to very quick replies with pointers to

http://pypi.python.org/pypi/dbf/

instead of to packages.python.org/dbf

So this packages.python.org subdomain is perhaps
unaware of its pypi.python.org competition, which
has a brighter and more open look and feel?

What's the story there I wonder?

It's quite simple actually.

http://packages.python.org/ :
"""
This site hosts documentation uploaded by authors of packages in the
Python Package Index (http://pypi.python.org).
"""

One is the actual package index, the other holds docs for packages in the index.

Cheers,
Chris
 
R

Robert Kern

Thanks to very quick replies with pointers to

http://pypi.python.org/pypi/dbf/

instead of to packages.python.org/dbf

So this packages.python.org subdomain is perhaps
unaware of its pypi.python.org competition, which
has a brighter and more open look and feel?

What's the story there I wonder?

pypi.python.org is the Python Package Index (PyPI). packages.python.org is a
service for packages on PyPI to host their documentation if they have no other
host. They are complementary services, not competition.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
J

Jon Clements

E

Ethan Furman

With Microsoft abandoning Visual FoxPro come 2015, we have 100K
developers
jumping ship (rough guess), perhaps to dot NET, but not necessarily.**

This page is potentially getting a lot of hits (I'm not privy to the
analytics):

http://packages.python.org/dbf/

The dbf package does not yet support index files. Normal indexes won't
be too hard to add in, but I have been unable to find the algorithms
used to create/work with compact index files.

Does anybody know where I might find those?

~Ethan~ (author of said package)
 
J

Jon Clements

The dbf package does not yet support index files.  Normal indexes won't
be too hard to add in, but I have been unable to find the algorithms
used to create/work with compact index files.

Does anybody know where I might find those?

~Ethan~  (author of said package)

I think John Machin has done work on this, or at least mentioned it in
a post somewhere. I could be wrong though - apologies to both you and
John, if I'm imagining things.

Jon.
 
K

kirby.urner

Playing around with arcane tools to read those pesky DBF files (with
memo fields), like floating wine barrels cast off the sinking VFP
ship.

http://pypi.python.org/pypi/dbf
http://packages.python.org/dbf/dbf-module.html

Me threading on comp.lang.python:
http://bit.ly/e547Za

xlwt and xlrt for reading and writing Excel data, without needing
Excel, are also making Python attractive

Here's a code fragment giving the idea:

from os import path
from time import time
import dbf

def test2():
thepath = path.normpath(<< file path >>)
thefile = "shiptemp.dbf"
pathfile = path.join(thepath, thefile)
thedbf = dbf.VfpTable(pathfile)

header_style = easyxf('font: name Arial, bold True, height 200;')

book = Workbook()
sheet1 = book.add_sheet('Sheet 1')

for (i, name) in enumerate(thedbf.field_names):
sheet1.write(0, i, name, header_style)

for (i, thecol) in enumerate(thedbf.structure()):
name, thetype = str(thecol).split()
thelen, thedec = 0,0
if "(" in thetype:
if "," in thetype:
thelen, thedec = [int(k) for k in
thetype[2:-1].split(",")]
else:
thelen, thedec = int(thetype[2:-1]), 0
thetype = thetype[0]
if thetype == "M":
thelen = 100
elif thelen == 0:
thelen = 1
colwidth = max(len(name), int(thelen))
# print colwidth
sheet1.col(i).width = colwidth * 310

thedbf.top()
messages = []
for row in range(1, len(thedbf)):
record = thedbf.next()
for col in range(len(thedbf.field_names)):
try:
sheet1.row(row).write(col, record[col])
except Exception:
pass

book.save("C:\\Documents and Settings\\HP_Administrator\\My
Documents\\Visual FoxPro Projects\\shiptemp.xls")

thedbf.close()

if __name__ == "__main__":
start = time()
test2()
end = time()
print end - start

At the moment I'm unable to get the 1500 record x 156 column table
(with memos) to stay in
memory even with the disk file closed, which I understand is a feature
of this package
http://pypi.python.org/pypi/dbf/
thetable = dbf.VfpTable(thefile)
thetable[1]
thetable.close(keep_table=True, keep_memos=True)

Traceback (most recent call last):
File "<pyshell#105>", line 1, in <module>
thetable.close(keep_table=True, keep_memos=True)
File "C:/Python26/Lib/site-packages\dbf\tables.py", line 1141, in
close
for record in yo:
File "C:/Python26/Lib/site-packages\dbf\tables.py", line 676, in
next
record = yo._table[yo._index]
File "C:/Python26/Lib/site-packages\dbf\tables.py", line 817, in
__getitem__
return yo._table[yo._index[value]]
File "C:/Python26/Lib/site-packages\dbf\tables.py", line 655, in
__getitem__
yo._meta.dfd.seek(location)
AttributeError: 'NoneType' object has no attribute 'seek'

Same error with:

Python 2.6 / Win7

Kirby
 
K

kirby.urner

Playing around with arcane tools to read those pesky DBF files (with
memo fields), like floating wine barrels cast off the sinking VFP
ship.

Although it's true I don't know that I'm getting "in memory"
DBF reads, the bulk of the time in the code I just shared is
in the "writing to XLS" inner loop.

Looking to a different solution for writing, perhaps a DLL
available for $ (one time).

Been reading more about VFP, Silverlight and HTML5. Python
seems in a good position. All caught up on IronPython now too.

Kirby
 
E

Ethan Furman

(e-mail address removed) wrote:

Some ideas:

for (i, name) in enumerate(thedbf.field_names):
sheet1.write(0, i, name, header_style)
thetype = thedbf.type(name)
thelen, thedec = thedbf.size(name)
if thetype == "M":
thelen = 100
elif thelen == 0:
thelen = 1
colwidth = max(len(name), int(thelen))
sheet1.col(i).width = colwidth * 310

messages = []
for row, record in enumerate(thedbf):
.
.
.
Same error with:

Does this still happen with the latest code? (Not yet on PyPI for those
following along -- hope to get a new package released this week.)


~Ethan~
 

Members online

No members online now.

Forum statistics

Threads
474,167
Messages
2,570,911
Members
47,453
Latest member
MadelinePh

Latest Threads

Top