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

Chance of possible python command issue with newer Macs [fixed] #477

Closed
kensoh opened this issue May 21, 2023 · 13 comments
Closed

Chance of possible python command issue with newer Macs [fixed] #477

kensoh opened this issue May 21, 2023 · 13 comments
Labels

Comments

@kensoh
Copy link
Member

kensoh commented May 21, 2023

Newer macOS does not come with Python installed. Even if users install manually, there could be a possibility of missing python command, at least for some reports from users of TagUI RPA engine here - aisingapore/TagUI#792 (comment)

Raising a pre-emptive issue here, so that rpa package users can both try the workaround in the link above and also please share here if you are running into this problem, so that I can confirm if this is also a problem for rpa package users and make a permanent solution.

@kensoh kensoh added the bug label May 21, 2023
@kensoh kensoh changed the title Possible python command issue with newer Macs - pending more reports Chance of possible python command issue with newer Macs - pending reports May 21, 2023
@antmanin
Copy link

antmanin commented Jun 7, 2023

there is no python, only python3 by default
solution in the link helped.
in files

  • /Users/user/.tagui/src/casperjs/bin/casperjs
  • /Users/user/.tagui/src/casperjs/tests/clitests/runtests.py
  • /Users/user/.tagui/src/slimerjs/slimerjs.py

change first line from #!/usr/bin/env python to #!/usr/bin/env python3

@marcelocecin
Copy link

marcelocecin commented Jun 8, 2023

pip3 install rpa
install homebrew
brew install php
open finder then go to path /Users/<YOUR_USER>/.tagui/src/
edit files casperjs runtests.py slimerjs.py as per previous comment above
python3 sample.py

@kensoh
Copy link
Member Author

kensoh commented Jul 2, 2023

Thanks @antmanin and @marcelocecin! Have you or could you kindly try if using symlink work? I can't really test this because my Mac is old and has both python 2 and python 3 now to accurately assess if below works.

If you don't have python command on Mac, could you run below to symlink python command to python 3? Folks who has similar issue without python command can try and share your feedback here too so I can update readme on best solution.

sudo ln -sf /usr/bin/python3 /usr/bin/python

@marcelocecin
Copy link

Hi Ken, unfortunately it doesn't work

@kensoh
Copy link
Member Author

kensoh commented Jul 4, 2023

Thanks @marcelocecin! Let me think over it. I think to ask users to hack those 3 files is an unacceptable solution. That should happen automatically behind the scenes. I'll have to chew over this because the execution pathways for Mac and Linux are similar so I have to be careful not to break Linux users scripts for the convenience of Mac newer version users.

@kensoh kensoh changed the title Chance of possible python command issue with newer Macs - pending reports Chance of possible python command issue with newer Macs - to investigate Jul 4, 2023
@kensoh
Copy link
Member Author

kensoh commented Jul 6, 2023

Writing the logic in _patch_macos_pjs() it seems to be doable and not fall into rabbit hole.

@kensoh
Copy link
Member Author

kensoh commented Jul 6, 2023

Hi @marcelocecin and @antmanin could you kindly help me run the following on your Mac?

I want to confirm the condition to check to autohack the 3 files automatically. Below should show False then True.

import os
print(os.system('python --version > /dev/null 2>&1') == 0)
print(os.system('python3 --version > /dev/null 2>&1') == 0)

For mine I already have Python 2 so can't be tested. But when I test with python4 it returns False as expected.

@marcelocecin
Copy link

Hi Ken, I'm traveling without my laptop. When I have access to it I will reply.

@kensoh
Copy link
Member Author

kensoh commented Jul 7, 2023

Sure @marcelocecin no hurry! This execution pathway affects all Mac users.
So I would wait for at least 1 PC with the target setup that works before rolling it out via PyPI.
In the meantime, folks can follow above workaround and change manually.

@antmanin
Copy link

antmanin commented Jul 7, 2023

@kensoh that works for me
image

kensoh added a commit that referenced this issue Jul 7, 2023
@kensoh
Copy link
Member Author

kensoh commented Jul 7, 2023

Thanks @antmanin! Hi @antmanin and @marcelocecin I've published v1.50. If you could, can you revert the local changes you made to the 3 files and see if this updated version automatically fixes the problem? It should be fine.

It will detect if user macOS has no python but has python3 and do the changes itself on first run.

@kensoh kensoh changed the title Chance of possible python command issue with newer Macs - to investigate Chance of possible python command issue with newer Macs [fixed] Jul 7, 2023
@kensoh
Copy link
Member Author

kensoh commented Jul 7, 2023

Above change will fix this round of issue when newer macOS has no python command.

Hopefully no more headaches from macOS.. The OS increasingly makes it hard for developers.

@kensoh
Copy link
Member Author

kensoh commented Jul 12, 2023

Closing issue because new users will already be using the latest package version that has this fix. Old users shouldn't have a use case where it is working and suddenly broken.

@kensoh kensoh closed this as completed Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants