Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3 install docs #35

Open
CarlFK opened this issue Aug 31, 2020 · 20 comments
Open

python 3 install docs #35

CarlFK opened this issue Aug 31, 2020 · 20 comments

Comments

@CarlFK
Copy link
Contributor

CarlFK commented Aug 31, 2020

Anyone have some notes or tips for installing on Python 3?

dabodev.com says "Some initial steps at porting to Python 3 have been made" which points to the dabo3 branch.

Which currently doesn't work for me:

$ git branch 
* dabo3
  master
$ python -c "from dabo.dReportWriter import dReportWriter "
You need to install wxPython; minimum version = 4.0.0.

this is new. for some value of new.
I am just generating pdfs on a web server, so I don't need a gui.

@jfabiani
Copy link
Contributor

jfabiani commented Aug 31, 2020 via email

@CarlFK
Copy link
Contributor Author

CarlFK commented Aug 31, 2020

I have rfxml files, I don't need to edit them, I just need render pdfs. So I don't need any of the UI parts working.

I am running this code on a web server, so I don't want to install or use wx. I'm guessing that requirement is a bit overreaching. I may try creating an empty wx module to appease the check and see if what I need working works.

@CarlFK
Copy link
Contributor Author

CarlFK commented Aug 31, 2020

Here is what I did to get the a pdf:

self.HomeDirectory = os.path.join(os.path.split(val)[:-1])[0]
https://github.com/dabodev/dabo/blob/master/dabo/lib/reportWriter.py#L3149
os.path.split(val)[:-1])[0]  / [0/) bug #25

dabo/lib/reportWriter.py
-import dabo.dConstants as kons / +from dabo import dConstants as kons

dabo/biz/dBizobj.py
Image / Pill.Image

dabo/biz/dBizobj.py
repalce spaces with tab

dabo/lib/reportWriter.py
# del k, v, Decimal

dabo/db/__init__.py
buffer/bytes

dabo/db/__init__.py
translation.ugettext /  translation.gettext

dabo/dLocalize.py
-from . import locale/ +import locale

dabo/__init__.py
uppercase / ascii_uppercase

dabo/lib/propertyHelperMixin.py
new.instancemethod / types.MethodType

2to3

Did all this to my master branch.

Ubuntu 18.04.5 LTS
Python 3.6.9 (default, Jul 17 2020, 12:50:27)

python3-pil version (5.1.0-1ubuntu0.3).
python3-reportlab version (3.4.0-3ubuntu0.1).

No wx, no designer.

@jfabiani
Copy link
Contributor

jfabiani commented Aug 31, 2020 via email

@jfabiani
Copy link
Contributor

jfabiani commented Sep 10, 2020 via email

@CarlFK
Copy link
Contributor Author

CarlFK commented Sep 10, 2020

Report Designer would be nice. every 6 months or so I touch the rfxml - I edit the xml and hit preview.

I ran a hotel? Hmm... that explain the gap in my resume ;)

Dabo3 branch didn't work for me. the blocker was:

$ python -c "from dabo.dReportWriter import dReportWriter "
You need to install wxPython; minimum version = 4.0.0.

I used master branch, which doesn't check for wx (I guess) and ran 2to3 over all the code.

@jfabiani
Copy link
Contributor

jfabiani commented Sep 10, 2020 via email

@jfabiani
Copy link
Contributor

jfabiani commented Sep 10, 2020 via email

@CarlFK
Copy link
Contributor Author

CarlFK commented Sep 10, 2020

I did come from Fox. Ed and Paul talked me into Python.
True story: I did a quick project (email white lister) and it was so easy I dismissed it as "bash with db access." two years later I took on another Python project and had to pay closer attention and wow was I put in my place. Fox out, Python in. never looked back and no regrets.

10 years ago I started making videos of talks at PyCon and other community ish conferences, which has come to a screeching halt as the equipment and sills needed for a live event don't really mean I am an expert at running an online event.

I have helped run 2 online events, helped a friend do a talk and gave a talk myself, so I may have more experience than anyone else now. top 10% anyway.

That said, I am currently working on light switch 2 point Oh. using CANbus to send messages from input devices to output devices. like a button and a light. the devices run Micro Python. it is working out to be pretty fun.

@jfabiani
Copy link
Contributor

jfabiani commented Sep 10, 2020 via email

@CarlFK
Copy link
Contributor Author

CarlFK commented Sep 13, 2020

Can you remove the check for wx?
then I can try out the report engine bits and let you know if anything there is 'interesting.'

I like this Switzerland restaurant idea. except now is a rough time to be running such things. A good friend turned the dining area of her restaurant into a frozen pizza shipping department and is paying the bills by shipping vegan pizza to 32 states.

@jfabiani
Copy link
Contributor

jfabiani commented Sep 14, 2020 via email

@CarlFK
Copy link
Contributor Author

CarlFK commented Sep 14, 2020

I am sure the wx error is a preemptive measure to make it more obvious what the error is, assuming the code hits something that depends on wx.

Here is my non wx code:

    rw = dReportWriter(OutputFile=buf, ReportFormFile=rfxmlfile, Cursor=ds)
    pdf = buf.getvalue()

https://github.com/CarlFK/veyepar/blob/master/dj/main/views.py#L699-L703
https://github.com/CarlFK/veyepar/blob/master/dj/main/templates/recording_sheets.rfxml

that pdf gets sent to the browser:
https://veyepar.nextdayvideo.com/main/recording_sheets.pdf/467/pyconau_2020_recording_sheets.pdf?day=5&location=curlyboi

@jfabiani
Copy link
Contributor

jfabiani commented Sep 14, 2020 via email

@CarlFK
Copy link
Contributor Author

CarlFK commented Sep 14, 2020

On branch dabo3 I made this one change:

# dReportWriter.py
...
from .settings import *
if implicitImports:
    from dabo import ui as dui

and created:

settings_override.py 
implicitImports = False 

and now I have a pdf. yay.

I have no idea the implications of the "import settings..." but it should only effect dReportWriter, and at least the pdf creation part works. Lets hope it doesn't take out the progress bar

@jfabiani
Copy link
Contributor

jfabiani commented Sep 14, 2020 via email

@CarlFK
Copy link
Contributor Author

CarlFK commented Sep 14, 2020

There are some other imports that also need to be skipped over, which are already under an if implicitImports:

from dabo import dEvents as dEvents
print("#1",__name__)

#1 dabo.dReportWriter

Which will also be the case if someone puts a "Print" button on a UI form.

https://docs.python.org/3/library/__main__.html:

'main' is the name of the scope in which top-level code executes. A module’s name is set equal to 'main' when read from standard input, a script, or from an interactive prompt.

@jfabiani
Copy link
Contributor

jfabiani commented Sep 14, 2020 via email

@CarlFK
Copy link
Contributor Author

CarlFK commented Sep 14, 2020

The change to dReportWriter.py should work for everyone.

I think it is just fine that I have a settings_override.py - it is like my file of database connection parameters.

@jfabiani
Copy link
Contributor

jfabiani commented Sep 14, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants