Opened 8 years ago

Closed 8 years ago

#51931 closed defect (fixed)

frescobaldi[-devel]: NameError: global name '_' is not defined

Reported by: mojca (Mojca Miklavec) Owned by: dliessi (Davide Liessi)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: frescobaldi frescobaldi-devel

Description

I opened an upstream issue as well:

I installed frescobaldi-devel, but I'm unable to run it:

Traceback (most recent call last):
  File "/opt/local/bin/frescobaldi", line 13, in <module>
    main.main()                     # Parse command line, create windows etc
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/frescobaldi_app/main.py", line 185, in main
    args = parse_commandline()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/frescobaldi_app/main.py", line 53, in parse_commandline
    argparse._ = _ # let argparse use our translations
NameError: global name '_' is not defined

I tried to explicitly set a python from MacPorts, but that didn't really help.

Unrelated (and to be put in a separate ticket eventually): I believe that the port should do some reinplace and use the Python interpreter provided by MacPorts if you want to rely on existence of pyqt.

Attachments (1)

Portfile-frescobaldi.diff (576 bytes) - added by dliessi (Davide Liessi) 8 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 in reply to:  description Changed 8 years ago by dliessi (Davide Liessi)

I've never seen this problem. I've just tried running Frescobaldi in Snow Leopard and El Capitan and it works as expected. I'll think about this.

Replying to mojca@…:

I tried to explicitly set a python from MacPorts, but that didn't really help.

What do you mean?

Unrelated (and to be put in a separate ticket eventually): I believe that the port should do some reinplace and use the Python interpreter provided by MacPorts if you want to rely on existence of pyqt.

As far as I understand there's no need for reinplace, since this is done in the destroot phase by Python itself: the first line in my copy of /opt/local/bin/frescobaldi says

#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

comment:2 Changed 8 years ago by mojca (Mojca Miklavec)

I'm sorry about that stupid reinplace remark. Being used to see the short /opt/local/bin/perl5.24 my subconscious mind skipped over the initial /opt/local in the path you mention above (I was probably expecting something like /opt/local/bin/python2.7 :) and I thought that the system python from /Library/Frameworks was being referenced. Please ignore that part.

The main problem still remains though. I asked on the python IRC channel and some devs claimed that it seemed strange to them that the code worked at all. Some suggested that lines like gettext.install() might be missing in the code (https://docs.python.org/2/library/gettext.html), but I have no idea how pyqt is supposed to handle translations, so I don't know any way forward (and also don't want to "blame myself" with stupidities on the upstream bug tracker as I'm not a python expert).

Last edited 8 years ago by mojca (Mojca Miklavec) (previous) (diff)

comment:3 Changed 8 years ago by dliessi (Davide Liessi)

As we discussed in the upstream tracker, the error is due to an incompatibility between frescobaldi and py27-future.

Given that the current version of Frescobaldi supports Python 3 and future versions will not run with Python 2, rather than adding conflicts py27-future and/or adding variants for both Python 2 and 3, I'll move frescobaldi to the latest stable Python 3.

Should I increase revision for this change? Probably yes, but since current installations work (unless py27-future is installed), I'm not sure...

comment:4 Changed 8 years ago by mojca (Mojca Miklavec)

Yes, you should certainly increase the revision after this kind of a change, else you risk all kinds of other problems.

Changed 8 years ago by dliessi (Davide Liessi)

Attachment: Portfile-frescobaldi.diff added

comment:5 Changed 8 years ago by dliessi (Davide Liessi)

Mojca: could you please apply the patch? Thanks.

comment:6 Changed 8 years ago by dliessi (Davide Liessi)

(Just for the record, the patch and comments 1, 3 and 5 are still by me, logged in with the wrong account.)

comment:7 Changed 8 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: newclosed

Thank you, r150933.

Note: See TracTickets for help on using tickets.