Help with Pyinstaller for Mac & Windows. Gaps in knowledge.

33 views
Skip to first unread message

Benjam901

unread,
Jan 11, 2021, 4:49:18 AMJan 11
to Python Programming for Autodesk Maya
Hello!

I have finally got my side project out for a closed beta and there are some issues for some users on both Mac & Windows.

Drag & Drop issue:
Firstly, you can drag & drop from the qsqltablemodel into an external program and that works ok on Mac but Windows you simply get a red no entry symbol and it fails to operate as it should. Is this an app permissions issue perhaps or a deeper windows bug? Which leads me to my next query.

Permissions issues:
Some users on Mac have had to chmod -x their .app files in order to run, I googled and some forums say I need to include a custom manifest file in order to elevate the app up to a level where this is not required.

However I am unfamiliar with what a manifest file is and what it should include to solve these issues?

Would this manifest elevation perhaps solve the above drag & drop issue on windows too?

My pyinstaller build code looks like this for Mac:
https://gist.github.com/4bea2a9975455e7c7e71aedc41b8c867

And like this for Windows:
https://gist.github.com/ben-hearn-sb/62763a3eac6cccd2c03478d913afd43c

I am certain I am missing something crucial here. If anyone could help with this it would be much appreciated!

// Ben

Justin Israel

unread,
Jan 11, 2021, 5:06:07 AMJan 11
to python_in...@googlegroups.com


On Mon, 11 Jan 2021, 10:49 pm Benjam901, <benandr...@gmail.com> wrote:
Hello!

I have finally got my side project out for a closed beta and there are some issues for some users on both Mac & Windows.

Drag & Drop issue:
Firstly, you can drag & drop from the qsqltablemodel into an external program and that works ok on Mac but Windows you simply get a red no entry symbol and it fails to operate as it should. Is this an app permissions issue perhaps or a deeper windows bug?

The drag and drop system is kind of this application agnostic protocol so that two completely unrelated apps can act as the drag source and drop target. The drag source would indicate the mine types provided in the drag event, and the drop target has the ability to choose what it accepts. 
If I saw that red indicator on Mac or Linux (of which I am more familiar) I would assume it is because the drag source is not specifying a mine type that the drop target wants. 

Which leads me to my next query.

Permissions issues:
Some users on Mac have had to chmod -x their .app files in order to run, I googled and some forums say I need to include a custom manifest file in order to elevate the app up to a level where this is not required.

However I am unfamiliar with what a manifest file is and what it should include to solve these issues?

Maybe this is what you are after? 

How are you distributing the mac app after it is built? If you are keeping it as just the app then maybe you are causing it to lose the execution mode if you happen to be copying it around in windows? If that is the case maybe compressing it with zip or tar.gz on the Mac and transferring that around would be a better idea? 


Would this manifest elevation perhaps solve the above drag & drop issue on windows too?

It doesn't seem like your drag and drop problem in windows is related to the execution mode issue of your Mac app. 


My pyinstaller build code looks like this for Mac:
https://gist.github.com/4bea2a9975455e7c7e71aedc41b8c867

And like this for Windows:
https://gist.github.com/ben-hearn-sb/62763a3eac6cccd2c03478d913afd43c

I am certain I am missing something crucial here. If anyone could help with this it would be much appreciated!

// Ben

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f8d96aaf-ce24-46f8-a679-a00a7b1503e8n%40googlegroups.com.

Benjam901

unread,
Jan 11, 2021, 5:24:39 AMJan 11
to Python Programming for Autodesk Maya
Hello Justin, Thanks for the quick response!


Windows perhaps needs something other than setUrls for its mime type?

Distribution:
I am distributing to the closed beta list as a zip which includes the .app file inside. Once unzipped you should be able to launch from anywhere. Should I consider packing as a .pkg or .dmg file perhaps? I am a bit unfamiliar with official protocols for distributing standalone apps on Mac at the moment.

Some users have no problems while others require to chmod which is not great for a regular user who has no idea what chmod is.

Thanks for the manifest pointer, I will try and muddle through to get the permissions setup correctly. Have you ever set one up before?

// Ben

Justin Israel

unread,
Jan 11, 2021, 12:57:27 PMJan 11
to python_in...@googlegroups.com
On Mon, Jan 11, 2021 at 11:24 PM Benjam901 <benandr...@gmail.com> wrote:
Hello Justin, Thanks for the quick response!


Windows perhaps needs something other than setUrls for its mime type?

So that implies that your windows drop target isn't accepting "text/uri-list" mimetype. Try additionally using setText() so that there is a "text/plain" mimetype as well. The text type will likely be the last type that gets checked, but that depends on the target.


Distribution:
I am distributing to the closed beta list as a zip which includes the .app file inside. Once unzipped you should be able to launch from anywhere. Should I consider packing as a .pkg or .dmg file perhaps? I am a bit unfamiliar with official protocols for distributing standalone apps on Mac at the moment.

Some users have no problems while others require to chmod which is not great for a regular user who has no idea what chmod is.

I'm not really certain what the best approach should be. I never had to publicly distribute mac app files. 8 years ago when I was building app files (with py2app) I was doing it for internal distribution directly as the app. pkg or dmg is probably more likely to retain the proper execution bits since their purpose is to handle installation. There are tools on osx for bundling into dmg. 
You could also try compressing as .tar.gz incase the issue is that a zip archive is stripping the execution bit for some users when they decompress.
 

Benjam901

unread,
Jan 12, 2021, 4:11:27 AMJan 12
to Python Programming for Autodesk Maya
I will experiment with changing the mime type depending on platform and see where that leads me. 

Packaging as a dmg did the trick. Zip for mac OS has always been a bit funny.

Some feedback I got from pyinstaller is the wait time when it unpacks to opening time can be a few seconds. With no immediate console or logo etc. some users first thought is that it is broken. I dug around and it appears --windowed can not be used in conjuction with --console which to me strikes a bit odd.

Do you know if there is a solution? I considered launching the .app/.exe through an intial much smaller file that should unpack quicker (hopefully) but that it a HELL of a hack to get around it...

Justin Israel

unread,
Jan 12, 2021, 4:32:56 AMJan 12
to python_in...@googlegroups.com


On Tue, 12 Jan 2021, 10:11 pm Benjam901, <benandr...@gmail.com> wrote:
I will experiment with changing the mime type depending on platform and see where that leads me. 

You can likely set both and the target will choose which mimetype it wants. 


Packaging as a dmg did the trick. Zip for mac OS has always been a bit funny.

Some feedback I got from pyinstaller is the wait time when it unpacks to opening time can be a few seconds. With no immediate console or logo etc. some users first thought is that it is broken. I dug around and it appears --windowed can not be used in conjuction with --console which to me strikes a bit odd.

Do you know if there is a solution?

I really don't have any ideas. It's been years since I even used py2app. Is it slow to load on windows? I think a windows exe will need to decompress to a temp before launching whereas the osx app is like a folder already. 

Benjam901

unread,
Jan 12, 2021, 8:37:52 AMJan 12
to Python Programming for Autodesk Maya
Its not super slow no, a few seconds only, perhaps that just has to be the limitation for the time being... 
Message has been deleted

Justin Israel

unread,
Jan 14, 2021, 10:57:36 PMJan 14
to python_in...@googlegroups.com
Well if you are now setting both url and text mime types, and the target is still rejecting the drop, the only other thing I can think of is that it is looking at the drop action (copy vs move vs targetmove) and still rejected it.

If you create your own qt window app to accept the drop and print the mime, does it work? Is it even your own qt target windows that dont work, or just some other windows apps?

On Fri, Jan 15, 2021 at 10:26 AM Benjam901 <benandr...@gmail.com> wrote:
Hello again,

So after some tinkering I still cannot get windows applications  to accept drag mime data from my SqlTableModel. I have tried the following with various commented out etc.:

mime_data = QMimeData()
mime_data.setUrls(files[0])
mime_data.setText(files[0])

b = bytearray()
b.extend(map(ord, files[0]))
mime_data.setData('text/plain', QByteArray(b))


Gist of my basic sqltablemodel:

Do you see the same behaviour if you implement these mine data types?

// Ben

Benjam901

unread,
Jan 15, 2021, 3:37:35 AMJan 15
to Python Programming for Autodesk Maya
I was thinking a little about that avenue of testing but was unsure the fruitfulness. I will do this with an additional Qt simple window and get back to you.

I created a dedicated thread for this topic btw for anyone searching later to easily find it so I will move our conversation over there:

Benjam901

unread,
Jan 25, 2021, 1:26:38 PMJan 25
to Python Programming for Autodesk Maya
Holy crap I got it...

Turns out... windows requires this little addition to the beginning of any fixed filepath in the system in order for drag and drop to work:

file:///C:/Users/Ben/Music/wildchars/Venda - 1.2 [pământ].wav

Which can be easily obtained via: QUrl.fromLocalFile(file_path)

I will update the other thread with a detailed answer for whomever may be struggling with this in the future too

Justin Israel

unread,
Jan 25, 2021, 4:37:38 PMJan 25
to python_in...@googlegroups.com


On Tue, 26 Jan 2021, 7:26 am Benjam901, <benandr...@gmail.com> wrote:
Holy crap I got it...

Turns out... windows requires this little addition to the beginning of any fixed filepath in the system in order for drag and drop to work:

file:///C:/Users/Ben/Music/wildchars/Venda - 1.2 [pământ].wav

Which can be easily obtained via: QUrl.fromLocalFile(file_path)

I will update the other thread with a detailed answer for whomever may be struggling with this in the future too

Nice find! 


Juan Moraga

unread,
Jan 25, 2021, 11:11:19 PMJan 25
to python_in...@googlegroups.com
hehehehe congratulations! These type of pesky details are always hard to figure out. Thanks for sharing your answer!

Reply all
Reply to author
Forward
0 new messages