Projects with __init__.py files

Asked by Jonathan Kossick on 2011-10-22

When I build the package of my programm the most __init__.py Files are missing. I think they were not moved.
What can I do to fix this problem?

Question information

Language:
English Edit question
Status:
Solved
For:
Quickly Edit question
Assignee:
No assignee Edit question
Solved by:
Jonathan Kossick
Solved:
2011-11-04
Last query:
2011-11-04
Last reply:
2011-10-23

This question was reopened

Tony Byrne (tony-badwolf) said : #1

Hi Jonathan

When I do this
$quickly create ubuntu-application initok
$cd initok
$ls -R |grep __init__
__init__.py
__init__.py

I see 2 entries for __init__.py
which are
initok/__init__.py and initok_lib/__init__.py

then
$quickly package
$ cd ..
and I look in initok_0.1_all.deb with file-roller
$ file-roller initok_0.1_all.deb
i can see /usr/share/pyshared/initok/__init__.py and /usr/share/pyshared/initok_lib/__init.py
which is exactly what I expected
Can you give more details of your problem

Jonathan Kossick (j-kossick) said : #2

I fixed the problem but I don't really know the reason for the problem, because I had only to copy the __init__.py from another folder in this folder. The new file has contrary to the old __init__py an icon in nautilus.

I also found the "data_files=[" option which is very useful but is there also an option to insert a whole folder?

Thanks for the help!

Tony Byrne (tony-badwolf) said : #3

Hi Jonathan

Have a look at
import glob

data_files=[('/destination', glob.glob('source_folder/*'))]

glob,glob will create a list of all the files in the source_folder.

Jonathan Kossick (j-kossick) said : #4

Thank you!! Problem solved!

Jonathan Kossick (j-kossick) said : #5

One last question: Is there a possibillity do give permissions to the files you insert with the data_folder[ option? The file is in the pyshared/my_project/directory.

Jonathan Kossick (j-kossick) said : #6

I changed the path of the files to the home directory, so I dont have this problem anymore.