Issues with Binance Package - enums

Having some trouble importing the Binance package into python. Specifically, I can't run the following lines:
from binance.client import Client
from binance.enums import *
When I install binance into my environment using this link [pip install python-binance], The code gets hung up on line one at >> from binance.client import Client. The import error I get is the following:
ImportError: dlopen(/Users/name/.local/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so, 2): no suitable image found. Did find:
/Users/name/.local/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so: mach-o, but wrong architecture
/Users/name/.local/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so: mach-o, but wrong architecture
Admittedly I'm not an expert in managing envs so any help would be greatly appreciated!
Cheers

Related

Why can't I install a library with a minus sign in it?

I'm new to Python and I'm trying to import a module that I installed, "python-evtx". I successfully installed it, but when I try to import it in the environment (Python 3.10.9) using Idle I get a syntax error that points at the "-" sign. As far as I can tell, import chokes on that"-" sign. Can anybody help? Thanks!
Here is a screenshot of my issue:
(https://i.stack.imgur.com/h9oxj.png)

golang ambiguous import using SDL

i am trying to get sdl working on linux mint and golang, i hav tried to install it using the commands on the github page and the i tried importing it
package main
import (
"fmt"
"github.com/veandco/go-sdl2/sdl"
)
but when ever i try to run it go buld main.go it spits out this error
main.go:6:2: ambiguous import: found package github.com/veandco/go-sdl2/sdl in multiple modules:
github.com/veandco/go-sdl2 v0.4.25 (/home/user/go/pkg/mod/github.com/veandco/go-sdl2#v0.4.25/sdl)
github.com/veandco/go-sdl2/sdl (/home/user/Desktop/golang/gui)
i have tried removing the file and re-installing it but it doesn't seem to work, i know it's probely my fault it's not working, thanks in advance (sorry for any bad english or grammer)

name 'BeautifulSoup' is not defined error

I searched some solution for this error code and I realized that this error's meaning requires rechecking in spelling and I retry to install module 'beautifulsoup'.
The error:
name 'BeautifulSoup' is not defined error
Frankly I don't have any idea for this error I think there is no error in code.
from bs4 import BeautifulSoup
from urllib.request import urlopen
url="http://finance.naver.com/marketindex"
page=urlopen(url)
soup=BeatifulSoup(page,"html.parser")
Just check whether your installation is not complete or not. To use beautiful soup, you need to install it:
$ pip install beautifulsoup4
Then you can use as the following
from bs4 import BeautifulSoup4
Note: You were doing
from bs4 import BeautifulSoup
which will not work as it is not correctly formatted.

py2app throws [errno 35] Resource Not Available during unconditional imports

I'm using python 2.7 installed via macports, pyobjc, cocoa and notably scipy (via FlowCytometryTools) with py2app to create a small mac application. Py2app's setup.py run with sudo python setup.py py2app completes nicely with -A for testing, but is unable to complete when running without that parameter to create a full .app build.
The build process will get a variable distance through the unconditional imports and then give error: [Errno 35] Resource temporarily unavailable and immediately exit. The number of unconditional import lines that complete before the error occurs changes. The longest run so far was seen when running immediately after a reboot. I've tried running with and without removing the previous build/dist folders to no effect.
Modules not found (unconditional imports):
...
* builtins.int (Cython.Build.Inline, Cython.Compiler.ExprNodes, IPython.utils._tokenizeerror: [Errno 35] Resource temporarily unavailable
My setup.py looks like this:
import sys
sys.setrecursionlimit(1500) #required to avoid recursion triggered early exit in py2app while compiling scipy. (default is 1000)
from setuptools import setup
APP = ['FlowMac.py']
DATA_FILES = ['FlowMac_Main.xib']
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
and the imports section of my python file FlowMac.py looks like this:
from Cocoa import *
from Foundation import *
from AppKit import *
from FlowCytometryTools import * #file/data handling via scipy and pandas
from pylab import * #graphing histograms
Commenting out both the FlowCytometryTools and the pylab imports allows the py2app build to complete but of course renders the program nonfunctional.
What is happening?
How can I get more information on which resource is unavailable?
was hitting a recursion limit a clue to my problem?
I'm running Yosemite on a MacBook Pro with 8GB RAM, so I'm very surprised to be hitting a wall here.
Thanks for your time.
UPDATE 4/29/2015:
Importing everything works fine if I remove my .xib from the datafiles array of the py2app launcher setup.py. A blank file with just import Cocoa, Foundation and Appkit works fine. Importing the xib with any one of FlowCytometryTools, pylab, scipy, matplotlib, numpy does not work. pylab and FlowCytometryTools rely on the other three, and any one of scipy, matplotlib or numpy brings in py2app recipies for the other two. One of these recipies isn't working with the xib, but I don't know why...
No experience with py2app, but I am wondering if you tried generating a more minimal version of the code that would fail to aid troubleshooting?
Maybe having FlowMac.py include nothing but the import statements:
import Cocoa
import Foundation
import AppKit
import FlowCytometryTools
import pylab
Also could you narrow it down to whether the problem appears due to pylab or due to FlowCytometryTools? (By commenting them out individually?)
From my testing, this error seems to be caused by the log output itself from py2app. Try redirecting standard error to a file:
python setup.py py2app 2>error_log
This should work around the error.

IPython fails to load win32api

I'm running Python 2.7 on windows and I've installed the pywin extension here.
Having done so, if I launch a normal python shell, I can import win32api perfectly.
If I do the same on IPython, I get this :
In [1]: import win32api
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
C:\Windows\system32\<ipython console> in <module>()
ImportError: DLL load failed: The specified module could not be found.
In [2]:
Why would it work in a normal python shell, but not IPython?
I had the same issue, and found a solution for my problem here. Apparently it's a conflict between pythoncom24.dll and pywintypes24.dll.
Look in your root Python install folder. If you find these two DLLs there, move them to \Python24\Lib\site-packages\win32 instead. This should fix your import conflict.
Alternately, you can control the imports explicitly. Add the following to your script in this order:
import pywintypes
import pythoncom
import win32api

Resources