Python Forum
How to Translate a python code written in Mac-OS to Windows?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Translate a python code written in Mac-OS to Windows?
#1
The code was written last year by a former colleague, and as it only works on Mac, I have to convert it to Windows.

The Python code will serve as a Bluetooth scanner searching for a device and retrieving data from the device.

I noticed one of the imported libraries is "objc".

What is the Windows equivalent of ObjC?

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import threading
import time
import os  #for Decrypt
[color=#9B59B6]import objc[/color]
from struct import *
import codecs
import numpy as np
import binascii
# my define function
Sorry, the rest of the code is intellectual property, so I cannot share the remaining.
Reply
#2
You need to say what you're using the library for, because perhaps there are Windows-specific (or cross-platform) libraries that do similar things for the parts you're using. I can't say I know anything about Objective-C or Cocoa.

One thing you'll want to do, if you haven't already is to hide away the uses of this library behind your own abstractions (i.e. classes or function as appropriate), so that the rest of the code only depends on those abstractions. That will allow you to swap out one implementation for another. Perhaps some design patterns like bridge or adapter might also be useful to you.
Reply
#3
The introduction of PyObjc, the project containing the objc module goes as follows
Quote:The PyObjC project aims to provide a bridge between the Python and Objective-C programming languages on macOS. The bridge is intended to be fully bidirectional, allowing the Python programmer to take full advantage of the power provided by various Objective-C based toolkits and the Objective-C programmer transparent access to Python based functionality.

PyObjC not only includes the basic bridge, but also bindings to most Apple frameworks on macOS.

The most important usage of this is writing Cocoa GUI applications on macOS in pure Python. See our tutorial for an example of this.
With this description of the project, we can assume that it is almost impossible to run the program in a Windows environment.

If however the objc module is used only for the GUI part of the program, you could perhaps rewrite only the GUI part with another GUI framework or even write a console based program with similar functionalities.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  googletrans library to translate text language for using data frame is not running gcozba2023 0 1,162 Mar-06-2023, 09:50 AM
Last Post: gcozba2023
  BeautifulSoup - I can't translate html tags that contain <a href=..</a> OR <em></em> Melcu54 10 1,563 Oct-27-2022, 08:58 AM
Last Post: wavic
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,599 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  Delimiters - How to skip some html tags from being translate Melcu54 0 1,619 May-26-2021, 06:21 AM
Last Post: Melcu54
  [split] SyntaxError when trying to execute code on Windows nehaya 2 1,959 Aug-04-2020, 11:18 AM
Last Post: nehaya
  SyntaxError when trying to execute code on Windows Fred0n 2 2,398 Apr-25-2020, 04:30 AM
Last Post: buran
  Translate to noob a Name Eroor message bako 2 2,186 Mar-30-2020, 05:58 PM
Last Post: bako
  Translate this line of code please keystone76 2 2,593 Jan-31-2020, 11:15 PM
Last Post: keystone76
  translate \ to / ? Skaperen 4 2,450 Oct-01-2019, 06:05 AM
Last Post: Skaperen
  Logger file rotation not working when python code started from windows service as exe nirvantosh 1 6,558 Jun-14-2019, 03:58 PM
Last Post: nirvantosh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020