[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Developing a Package with Sub Packages

Gabriel Genellina

2/18/2008 8:03:00 PM

En Mon, 18 Feb 2008 16:23:28 -0200, Josh English
<joshua.r.english@gmail.com> escribi�:

> When testing the package in idle, this results in
> C:\Python25\Lib\idlelib
> instead of the file.
> The Data folder is created in this folder now.

Works for me:

main.py:
from testpkg import a

testpkg directory (a subdirectory somewhere in sys.path):
testpkg\__init__.py:
(empty file)

testpkg\a.py:
import os
print __name__, __file__, os.path.abspath(os.path.dirname(__file__))

In IDLE: File -> Open, main.py. F5 (Run Module). Output:

testpkg.a C:\APPS\PYTHON25\lib\site-packages\testpkg\a.pyc
C:\APPS\PYTHON25\lib\site-packages\testpkg

--
Gabriel Genellina