Troubles with compiling .py file to .app using py2app - python

I want to make an app file with py2app. I installed py2app with pip, and proceeded to create the app file in terminal:
$ cd /Users/<username>/Desktop/pytoapp
$ py2applet --make-setup a_py2app.py
Wrote setup.py
Up until this point it went all right, but watch what happened next (skip to the 3 last rows for the relevant information):
$ python setup.py py2app
running py2app
creating /Users/<username>/Desktop/pytoapp/build
creating /Users/<username>/Desktop/pytoapp/build/bdist.macosx-10.14-intel
creating /Users/<username>/Desktop/pytoapp/build/bdist.macosx-10.14-intel/python2.7-standalone
creating /Users/<username>/Desktop/pytoapp/build/bdist.macosx-10.14-intel/python2.7-standalone/app
creating /Users/<username>/Desktop/pytoapp/build/bdist.macosx-10.14-intel/python2.7-standalone/app/collect
creating /Users/<username>/Desktop/pytoapp/build/bdist.macosx-10.14-intel/python2.7-standalone/app/temp
creating /Users/<username>/Desktop/pytoapp/dist
creating build/bdist.macosx-10.14-intel/python2.7-standalone/app/lib-dynload
creating build/bdist.macosx-10.14-intel/python2.7-standalone/app/Frameworks
*** using recipe: virtualenv ***
*** using recipe: sip ***
*** using recipe: email ***
*** filtering dependencies ***
475 total
69 filtered
9 orphaned
406 remaining
*** create binaries ***
*** byte compile python files ***
byte-compiling /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py to _markerlib/__init__.pyc
[…]
[reams of unimportant crap]
[…]
bdist.macosx-10.14-intel/python2.7-standalone/app/collect/test/testrgb.uue
copying file /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/floating_points.txt -> /Users/<username>/Desktop/pytoapp/build/bdist.macosx-10.14-intel/python2.7-standalone/app/collect/test/floating_points.txt
*** creating application bundle: a_py2app ***
error: [Errno 1] Operation not permitted: '/Users/<username>/Desktop/pytoapp/dist/a_py2app.app/Contents/MacOS/a_py2app'
I get an error, saying "operation not permitted". How do I resolve this? I'm the admin, and I use Python 3.7.

Related

robotframework appium - WebDriverException: Message: platform name is missing in the capabilities

when i write a simple test case i get an error like below
==============================================================================
Example
==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No application is open
Example Case | FAIL |
WebDriverException: Message: platform name is missing in the capabilities
------------------------------------------------------------------------------
Example | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
My robot file
*** Settings ***
Library AppiumLibrary
*** Variables ***
${REMOTE_URL} secretHubLink
${APP} secretAppUrl
${PLATFORM_NAME} Android
${PLATFORM_VERSION} 10
${DEVICE_NAME} Galaxy S20
*** Test Cases ***
Example Case
Open Application ${REMOTE_URL} platformName=${PLATFORM_NAME} platformVersion=${PLATFORM_VERSION} deviceName=${DEVICE_NAME} app=${APP} name=Robot Framework Sample Test build=Appium Python Robot
My requirements.txt
robotframework-appiumlibrary
My Packages: (pip freeze)
Appium-Python-Client==2.7.1
async-generator==1.10
attrs==22.2.0
certifi==2022.12.7
decorator==5.1.1
docutils==0.19
exceptiongroup==1.1.0
h11==0.14.0
idna==3.4
kitchen==1.2.6
outcome==1.2.0
PySocks==1.7.1
robotframework==6.0.1
robotframework-appiumlibrary==2.0.0
selenium==4.7.2
six==1.16.0
sniffio==1.3.0
sortedcontainers==2.4.0
trio==0.22.0
trio-websocket==0.9.2
urllib3==1.26.13
wsproto==1.2.0
selenium==4.7.2
Os: Linux / Ubuntu 20.04.4 LTS
Python version: 3.8.10
${REMOTE_URL} http://127.0.0.1:4723/wd/hub
${MAIN_ACTIVITY} com.dev
*** Keywords ***
Start Up Application
[Documentation] Starts up application session
[Arguments] ${platformName} ${platformVersion}= ${deviceName}= ${portNumber}=4723
${appName}= Get App Name
${bundleName}= Run Keyword If '${platformName.lower()}' == 'ios' Get iOS Bundle Name
... ELSE Get Android Bundle Name
Run Keyword If '${platformName.lower()}' == 'ios' Open Application ${REMOTE_URL} waitForQuiescence=false wdaEventloopIdleDelay=3 platformName=${platformName} platformVersion=${platformVersion} deviceName=${deviceName} app=${appName} bundleId=${bundleName} autoAcceptAlerts=true connectHardwareKeyboard=true
... ELSE Open Application ${REMOTE_URL} platformName=${platformName} platformVersion=${platformVersion} deviceName=${deviceName} appPackage=${bundleName} appActivity=${MAIN_ACTIVITY} autoGrantPermissions=true noReset=true
*** Settings ***
Documentation Smoke Demo
...
#Test Setup AppiumLibrary.Launch Application
Test Teardown Close Application
Library AppiumLibrary
Library OperatingSystem
*** Variables ***
${ANDROID_AUTOMATION_NAME} UIAutomator2
${ANDROID_APP} AbsPath to Your .apk
${ANDROID_PLATFORM_NAME} Android
${ANDROID_PLATFORM_VERSION} %{ANDROID_PLATFORM_VERSION=13}
*** Test Cases ***
Should Open App
Open Test Application
*** Keywords ***
Open Test Application
Open Application http://127.0.0.1:4723/wd/hub automationName=${ANDROID_AUTOMATION_NAME}
... platformName=${ANDROID_PLATFORM_NAME} platformVersion=${ANDROID_PLATFORM_VERSION}
... app=${ANDROID_APP} appPackage=io.appium.android.apis appActivity=.app.SearchInvoke
Please check this one a simpler option, works for me
here sample .apk that I use for this test
Guide with simple example here
source code

command to run robot file where i can specify python version as well

I have installed both python 2.7 and 3.7 on my system and configured python 3.7 in pycharm.
Ran below command to installed robotframework for web automation:
python3 -m pip install robotframework
python3 -m pip install robotframework-seleniumlibrary
Written this code in pycharm:
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${Browser} Chrome
${url} http://demo.guru99.com/test/newtours/register.php
*** Test Cases ***
Test title
Open_Browser ${url} ${Browser}
now when I trying to run this code from cmd with command "robot TC_002.robot"
getting error:
[ ERROR ] Error in file 'C:\python\RobotFramework\TC_002.robot' on line 2: Non-existing setting 'Library SeleniumLibrary
Is there another command which I can use to run from cmd along with python version?
The problem is you didn't include at least 2 spaces between Library and SeleniumLibrary, you did this:
*** Settings ***
Library SeleniumLibrary
when I run this using robot, it gives me exactly the same error:
Non-existing setting 'Library SeleniumLibrary'.
You should write:
*** Settings ***
Library SeleniumLibrary
Please format your code next time, it's hard to find out where the error is when the code is just placed in between normal text.

How to debug python wheel build on macos remote server (azure pipelines)

I try to build wheel for imagecodecs python package. Previous version I build without any problem.
For current revision I got wheels for linux (manylinux2010) and macos, but without openmp support.
I would like to build also with openmp support. For this purpose I use gcc from brew.
From previous version of imagecodecs to dependency there is added snappy, zopflipy and changed version of jxrlib.
I use cibuildweel to build wheel so it is build with python installed from official pkg files.
Build pass, then when test start it fail with (on azure pipelines)
python(53258,0x7fffa20fb380) malloc: *** error for object 0x109c85c00: pointer being freed was not allocated
When I download it on my computer whole test set pass.
On azure pipelines there is no option to login on machine. I try to debug it with
lldb --batch -o "br set -n malloc_error_break" -o "run" -o "bt" -o "c" -- python -m pytest {project}/tests/
Then I got:
+ lldb --batch -o "br set -n malloc_error_break" -o "run" -o "bt" -o "c" -- python -m pytest /Users/runner/runners/2.163.1/work/1/s/tests/
(lldb) target create "python"
Current executable set to 'python' (x86_64).
(lldb) settings set -- target.run-args "-m" "pytest" "/Users/runner/runners/2.163.1/work/1/s/tests/"
(lldb) br set -n malloc_error_break
Breakpoint 1: where = libsystem_malloc.dylib`malloc_error_break, address = 0x00000000000119e6
(lldb) run
============================= test session starts ==============================
platform darwin -- Python 2.7.17, pytest-4.6.8, py-1.8.0, pluggy-0.13.1
python(53294,0x7fff97d45380) malloc: *** error for object 0x10fc3ec00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Process 53294 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00007fff5f7d89e6 libsystem_malloc.dylib`malloc_error_break
libsystem_malloc.dylib`malloc_error_break:
-> 0x7fff5f7d89e6 <+0>: pushq %rbp
0x7fff5f7d89e7 <+1>: movq %rsp, %rbp
0x7fff5f7d89ea <+4>: nop
0x7fff5f7d89eb <+5>: nopl (%rax)
Target 0: (python) stopped.
Process 53294 launched: '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmp_g9gpq37/bin/python' (x86_64)
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
* frame #0: 0x00007fff5f7d89e6 libsystem_malloc.dylib`malloc_error_break
frame #1: 0x00007fff5f7ca82d libsystem_malloc.dylib`free + 400
frame #2: 0x000000010face5bd libstdc++.6.dylib`std::locale::_Impl::~_Impl() + 109
frame #3: 0x00007fff97d24998 libsystem_c.dylib`__stdinp + 8
(lldb) c
Whole code is here https://github.com/Czaki/imagecodecs/tree/2019.12.16
Pipelines are here https://dev.azure.com/bokota/open%20source%20contrib/_build?definitionId=3&_a=summary
Any idea how I can debug this? How to find where pointer is created?
EDIT
In this case problem is connected with compiling zopflipy with gcc-9/g++-9. I need to compile test dependencies with clang
You can check Enable system diagnostics to get verbose logs when you Run pipeline.
You can also click add variable to add a variable named system.debug and set its value to true. Please refer to troubleshoot build and release.
If you would like to login on the agent machine. You can configure your self-hosted agent, which will allow you to login and troubleshoot your builds.

uwsgi not starting up

I keep getting this error in by terminal after pip install uwsgi and running uwsgi
I've tried various things thinking it is a gcc path error so added the location to libc.so.6 but it didn't help.
SOMEBODY PLEAAASSSEEE help!
!!! uWSGI process 10506 got Segmentation Fault !!!
*** backtrace of 10506 ***
uwsgi(uwsgi_backtrace+0x2c) [0x46429c]
uwsgi(uwsgi_segfault+0x21) [0x464641]
/lib64/libc.so.6(+0x35670) [0x7fc0fe450670]
uwsgi(uwsgi_setup+0x24b) [0x466a5b]
uwsgi(main+0x9) [0x41ac29]
/lib64/libc.so.6(__libc_start_main+0xf5) [0x7fc0fe43cb15]
uwsgi() [0x41ac59]
*** end of backtrace ***
I got the answer...It's because pip install uwsgi needs to be on version 2.0.14 instead of 2.0.15...There is definitely a bug in the newer version!

FoxySheep build error in python

I am trying to build FoxySheep for python. But I am getting the following error:
Here is the log:
~/Downloads/FoxySheep-master$  cd python_target
~/Downloads/FoxySheep-master/python_target$  make
antlr4 -Dlanguage=Python2 -o generated -visitor ../FoxySheep.g4
make: antlr4: No such file or directory
make: *** [generated/FoxySheepParser.py] Error 1
You need to have antlr4 installed on your system. There is a quickstart on http://www.antlr.org that should get you up and running.

Categories

Resources