I encounter this problem trying to open an excel file with the following code :
#===================================
#different import
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
section_copper = 50.11*8.04#[mm2]
section_alu = 50.18*5.07 #[mm2]
section_composite = 53.24*4.49 #[mm2]
section_steel = 50.35*10.23 #[mm2]
length = 400 #[mm]
data_steel = pd.read_excel(r"C:\Users\Alex\Downloads\MAPR2481-Lab1.xlsx",sheet_name=0)
data_aluminium = pd.read_excel(r"C:\Users\Alex\Downloads\MAPR2481-Lab1.xlsx",sheet_name=1)
data_copper = pd.read_excel(r"C:\Users\Alex\Downloads\MAPR2481-Lab1.xlsx",sheet_name=2)
data_composite = pd.read_excel(r"C:\Users\Alex\Downloads\MAPR2481-Lab1.xlsx",sheet_name=3)
The following message can be found in the console :
runfile('C:/Users/Alex/.spyder-py3/lab 1.py', wdir='C:/Users/Alex/.spyder-py3')
Traceback (most recent call last):
File "<ipython-input-16-9c6aa501dded>", line 1, in <module>
runfile('C:/Users/Alex/.spyder-py3/lab 1.py', wdir='C:/Users/Alex/.spyder-py3')
File "C:\Users\Alex\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Users\Alex\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Alex/.spyder-py3/lab 1.py", line 3, in <module>
import numpy as np
File "C:\Users\Alex\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 143, in <module>
from . import _distributor_init
File "C:\Users\Alex\AppData\Roaming\Python\Python37\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\Alex\Anaconda3\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
I would be very grateful if someone could help me !
Please check this answer here
You are using Anaconda i assume.
You have installed the wrong version of python, like you have a 32bit system and u installed 64bit version of python.
Solution: re-install Anaconda as administrator (but first delete the first and all associated files with it).
hope this solves your issue.
Related
Today I've run into problems trying to use the python-bitcoinlib in a small python program. It worked perfectly a few days ago but today the library seems to be broken (see console output below).
I'm in a Mac with OS X 11.0.1 (yes, I upgraded today, but I would be surprised if that's the cause of the problem).
I've tried several times installing and uninstalling the library and even python, but nothing seems to happen.
Thanks in advance.
>>> from bitcoin.rpc import RawProxy
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
from bitcoin.rpc import RawProxy
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bitcoin/rpc.py", line 48, in <module>
from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bitcoin/wallet.py", line 33, in <module>
import bitcoin.core.key
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bitcoin/core/key.py", line 34, in <module>
_ssl = ctypes.cdll.LoadLibrary(ctypes.util.find_library('ssl') or 'libeay32')
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libeay32, 6): image not found
My solution is not using RawProxy.
Impor this instead:
from bitcoinrpc.authproxy import AuthServiceProxy
And connect to bitcoin core with this sentence or equivalent:
p = AuthServiceProxy("http://%s:%s#127.0.0.1:8332"%(rpcuser, rpcpassword))
This question already has answers here:
What exactly is current working directory?
(5 answers)
Closed 27 days ago.
I am using a python package from Gray Arrow's Dejavu. I have installed all the required dependencies and other packages necessary to run my code. When running the following code:
import warnings
import json
warnings.filterwarnings("ignore")
from dejavu import Dejavu
from dejavu.recognize import FileRecognizer
with open('dejavu.cnf') as f:
config = json.load(f)
djv = Dejavu(config)
djv.fingerprint_file('mp3/Sean-Fournier--Falling-For-You.mp3')
song = djv.recognize(FileRecognizer, 'mp3/Sean-Fournier--Falling-For-
You.mp3')
print("from file recognized: {}\n".format(song))
I receive the following errors:
Traceback (most recent call last):
File "testing.py", line 13, in <module>
djv.fingerprint_file('mp3/Sean-Fournier--Falling-For-You.mp3')
File "D:\dejavu-master\dejavu\__init__.py", line 109, in
fingerprint_file song_name=song_name
File "D:\dejavu-master\dejavu\__init__.py", line 182, in
_fingerprint_worker channels, Fs, file_hash = decoder.read(filename,
limit)
File "D:\dejavu-master\dejavu\decoder.py", line 51, in read
audiofile = AudioSegment.from_file(filename)
File "C:\Program Files\Python37\lib\site-
packages\pydub\audio_segment.py", line 665, in from_file info =
mediainfo_json(orig_file)
File "C:\Program Files\Python37\lib\site-packages\pydub\utils.py",
line 263, in mediainfo_json res = Popen(command,
stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
File "C:\Program Files\Python37\lib\subprocess.py", line 775, in
__init__ restore_signals, start_new_session)
File "C:\Program Files\Python37\lib\subprocess.py", line 1178, in
_execute_child startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file
specified
I have done complete re-installations of python 3.7 and all of the packages and dependencies to attempt correction of this problem.
I do not understand what file cannot be found and have done research in hopes to find an answer to this issue. I truly appreciate any help and knowledge that can be shared with me on this topic.
Try and place "Sean-Fournier--Falling-For-You.mp3" file in the exact directory you have your script, I don't think the folder reference to the mp3 folder is being handled correctly :)
djv.fingerprint_file('mp3/Sean-Fournier--Falling-For-You.mp3')
song = djv.recognize(FileRecognizer, 'mp3/Sean-Fournier--Falling-For-
You.mp3')
I'm relatively new to Python and am trying to analyze an entire folder of netCDF files. When I try to run my code I get the key error: u'satcode'. Here is my code:
import netCDF4 as nc
import glob
import numpy as np
filenames = []
for name in glob.glob("/Users/my_name/Desktop/ISCCP/*"):
print name
filenames.append(name)
# below reads multiple files (file_list)
f = nc.MFDataset(filenames)
I know the error is with f = nc.MFDataset(filenames), but I don't know why.
My traceback says:
runfile('/Users/my_name/.spyder/West_Coast_Model.py', wdir='/Users/my_name/.spyder')
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGG.v01r00.GLOBAL.1983.07.01.0000.GPC.10KM.CS00.EA1.00 (5).nc
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGH.v01r00.GLOBAL.1983.07.99.0300.GPC.10KM.CS00.EA1.00.nc
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGH.v01r00.GLOBAL.1983.07.99.0600.GPC.10KM.CS00.EA1.00.nc
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGH.v01r00.GLOBAL.1983.07.99.0900.GPC.10KM.CS00.EA1.00.nc
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGH.v01r00.GLOBAL.1983.07.99.1200.GPC.10KM.CS00.EA1.00.nc
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGH.v01r00.GLOBAL.1983.07.99.1500.GPC.10KM.CS00.EA1.00.nc
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGH.v01r00.GLOBAL.1983.07.99.1800.GPC.10KM.CS00.EA1.00.nc
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGH.v01r00.GLOBAL.1983.07.99.2100.GPC.10KM.CS00.EA1.00.nc
/Users/my_name/Desktop/ISCCP/ISCCP-Basic.HGH.v01r00.GLOBAL.1983.08.99.0000.GPC.10KM.CS00.EA1.00.nc
Traceback (most recent call last):
File "", line 1, in
runfile('/Users/my_name/.spyder/West_Coast_Model.py', wdir='/Users/my_name/.spyder')
File "/Users/my_name/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "/Users/my_name/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, *where)
File "/Users/my_name/.spyder/West_Coast_Model.py", line 20, in
f = MFDataset(filenames)
File "netCDF4/_netCDF4.pyx", line 5888, in >netCDF4._netCDF4.MFDataset.init
KeyError: u'satcode'
I think I figured out the problem. The 0th term in the files was corrupted, so I redownloaded it and converted it into netCDF4_CLASSIC and it worked.
When I execute the following statement in my code on my Mac OS X
import json, nltk, requests, time, smtplib, uuid
I have the followiong error:
18/01/22 22:03:15 INFO TaskSetManager: Lost task 235.0 in stage 4.0 (TID 16) on executor localhost: org.apache.spark.api.python.PythonException (Traceback (most recent call last):
File "/usr/local/spark/python/lib/pyspark.zip/pyspark/worker.py", line 98, in main
command = pickleSer._read_with_length(infile)
File "/usr/local/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 164, in _read_with_length
return self.loads(obj)
File "/usr/local/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 422, in loads
return pickle.loads(obj)
File "utils.py", line 6, in <module>
import json, nltk, requests, time, smtplib, uuid
File "/Library/Python/2.7/site-packages/nltk/__init__.py", line 114, in <module>
from nltk.collocations import *
File "/Library/Python/2.7/site-packages/nltk/collocations.py", line 39, in <module>
from nltk.metrics import ContingencyMeasures, BigramAssocMeasures, TrigramAssocMeasures
File "/Library/Python/2.7/site-packages/nltk/metrics/__init__.py", line 16, in <module>
from nltk.metrics.scores import (accuracy, precision, recall, f_measure,
File "/Library/Python/2.7/site-packages/nltk/metrics/scores.py", line 16, in <module>
from scipy.stats.stats import betai
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/stats/__init__.py", line 324, in <module>
from .stats import *
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/stats/stats.py", line 242, in <module>
import scipy.special as special
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/special/__init__.py", line 531, in <module>
from ._ufuncs import *
File "numpy.pxd", line 155, in init scipy.special._ufuncs (scipy/special/_ufuncs.c:19983)
ValueError: numpy.dtype has the wrong size, try recompiling
As you can see from log, I'm using python 2,7 and pyspark (spark 1.6).
Maybe the problem is related to the fact that the software tries to use OSX system Python that use a specific version of numpy and I'm not able to understand how can avoid this.
Anyone can help me?
At this link: ValueError: numpy.dtype has the wrong size, try recompiling
the problem is related to the binary distribution of packages that are compiled against a recent version of numpy.
In my case it seems that spark refer the OSX system python ("/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/stats/stats.py") instead of the "/Library/Python/2.7" i'm using in my virtual env.
I'm trying to use the library pydub, but when I run the script i get this.
runfile('E:/OneDrive - usach.cl/chillbot/pydub.py', wdir='E:/OneDrive - usach.cl/chillbot')
Traceback (most recent call last):
File "<ipython-input-203-a38a65fe4502>", line 1, in <module>
runfile('E:/OneDrive - usach.cl/chillbot/pydub.py', wdir='E:/OneDrive - usach.cl/chillbot')
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "E:/OneDrive - usach.cl/chillbot/pydub.py", line 9, in <module>
from pydub import AudioSegment
File "E:\OneDrive - usach.cl\chillbot\pydub.py", line 9, in <module>
from pydub import AudioSegment
ImportError: cannot import name 'AudioSegment'
I don't find information about the error, I'm using windows 10 with anaconda, the code that I'm running is.
from pydub import AudioSegment
AudioSegment.ffmpeg = "C:\ffmpeg\bin"
song = AudioSegment.from_mp3("I_eat_Plants_for_a_living-Unfaithful.mp3")
If I delete all the code except from pydub import AudioSegment I get the same error.
Having a file named pydub.py is a red flag. Try renaming it?