Posts

Post not yet marked as solved
6 Replies
It is posted, moderation approved, can you see the error?
Post not yet marked as solved
6 Replies
My answer is currently being monitored for a few days now, i copy pasted an error that I had but it shows its being moderated. I tried editing some of the pasting but it dosent seem to work. So I just wait or am I doing something wrong?
Post not yet marked as solved
6 Replies
So I researched some more and I found PythonKit, which I found in the website, however, it throws up an error when I try to impliment it.Fatal error: Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library.: file /Users/****/Library/Developer/Xcode/DerivedData/Y******L-fmpvatcxzxcglggfnkmiateqeipe/SourcePackages/checkouts/PythonKit/PythonKit/PythonLibrary.swift, line 402019-12-31 19:10:33.397840-0700 iSee[4616:1847618] Fatal error: Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library.: file /Users/*****/Library/Developer/Xcode/DerivedData/Y******L-fmpvatcxzxcglggfnkmiateqeipe/SourcePackages/checkouts/PythonKit/PythonKit/PythonLibrary.swift, line 40I found the location of where the code asks to throw up that error.public struct PythonLibrary { private static let shared = PythonLibrary() private static let pythonLegacySymbolName = "PyString_AsString" private static var librarySymbolsLoaded = false private let pythonLibraryHandle: UnsafeMutableRawPointer private let isLegacyPython: Bool private init() { guard let pythonLibraryHandle = PythonLibrary.loadPythonLibrary() else { fatalError(""" Python library not found. Set the \(Environment.library.key) \ environment variable with the path to a Python library. """) } self.pythonLibraryHandle = pythonLibraryHandleon line 11 it shows that.The code was a swift packagebelow is the code in viewcontroller // let os: PythonObject = Python.import("os") // print ("os") let sys: PythonObject = Python.import("sys") print("sys") sys.path.append("/usr/local/lib/python3.7/site-packages") // sys.path.append("/Users/*****/Applications/Python 3.8")The error throw up when it hits line 08.Any help here? It would be amazing, again I searched, but I couldn't find a solution that would work, or I didn't understand what they were talking about?Thanks.
Post marked as solved
10 Replies
Yes, thank you, the wifi must have disconnected or something because I pressed it, or I might have forgotten... But thank you
Post marked as solved
10 Replies
here's the current code with that errorvar extract = selected.map {$0.rect} // running other functions. mapping out what we need, rect is my rectangle info let finishedextracting = extract.flatMap() { [$0.0, $0.1, $0.2, $0.3]} //The error shows the 0, 1, 2, and 3, in 0.0 etc, dont exist in CGRect
Post marked as solved
10 Replies
So I'm putting the first one in wit the .flatMap, and it's throwing an error saying that value of type 'CGRECT' has no type '0', and so one for the other ones. any suggestions?
Post marked as solved
10 Replies
I have an assignment that says something like this"Extract the values from the rectangle values that are located in the tuple inside an array below[(120, 375, 24, 24)] "It should be simple, but I can't extract it. There are no labels or something
Post marked as solved
7 Replies
Here is the problemlet arrayValues = ["apples", "bannanas", "cherry", "date", "eggplant", "dorito"]As you can see in this array there is no x, and the computer will recognise it, and throw up an errorI am looking for the value of x, and not "x" itself.What I am testing is not a boolen function. Check my reply to OOper below
Post marked as solved
7 Replies
So the computer assigns a random integer from 0-5 and assigns it to x and yinput:x = 1y = 2after the program runs whatever function it is to calculate the indexes of the array and match it up with x = 1 and y = 2so the array =let arrayValues = ["apples", "bannanas", "cherry", "date", "eggplant", "dorito"] Following that the computer would enumerate the objectslet arrayValues = [0: "apples", 1:"bannanas", 2:"cherry", 3:"date", 4: "eggplant", 5:"dorito"] here is the output:the computer would look at the enumerated objects and then change the input variables intox = "bannanas"andy = "cherry"In the end, basically replacing the random generated numeral and replacing it with the array. The preoblem is, I have to have x and y generate random integers, I understand that it is possible to randomly select an array value, it is the same concept, and 1. In this specific case I cannot use that function, 2. I want to see if there is other functions that can do the same thing. Here is another exampleinput:x= 4y = 0output:x = "eggplant"y = "apples"
Post marked as solved
7 Replies
I apologize, it is confusing. I don't know what to do so there is no code yet. My previous attempts are snippets and are not whole. I'm looking if there is a function to do this process below before I start coding again.The values are values of the variables x and y, in this specific case the values are 3 and 5, however, the values of x and y will change every loop.As well as the fact if we convert the numbers into strings it would be pointless again, because it would be searching for "x", and not searching for the actual value of x.What I was trying to say here is simply I tried the function arrayValue.containsand in order to do that .contains function, I would need to string x, which would make the .contains function search for "x", instead of the actual value of x, in this example is 3.if arrayValue.contains("x"){}Sorry if it's not clear, I'll do my best, since I am confused myself.