Issue running energyplus using eppy idf.run() - python

I'm having a problem running the following chunk of code in Jupyter Notebook:
i=[0,1,2,3]
from eppy.runner import run_functions
for i in i:
OA.Economizer_Control_Type = ECT[i]
idf1.saveas('C:/Users/mdahdolan/Dropbox/Work and Studies/Economizer
Study/Python/1A_Small_Office.idf')
print(OA.Economizer_Control_Type)
idf1.run(verbose='v')
and I'm getting this error:
om/bEI6B.jpg

You have issues with the path in the function saveas(), check that the route is available, exists and you can reach it without privileges ;)

Related

TypeError: 'dict_keys' object is not callable

I have used the below program to get the maximum and minimum value in a dictionary. But, there is an type error.
I am running the below code on Jupyter notebook and getting the type error as the 'dict.keys' object is not callable. same code runs successfully on the pycharm.
Please advise me what changes should I make so that the code runs successfully on the jupyter notebook?
what is wrong in my code? Code run on JupyterNBcode run on Pycharm successfully
I have tested your program in Jupyter Notebook and the code is working just fine. Maybe you check for any typos. Hope this help
Code snippet run on jupyter notebook
Yup I can run your code perfectly too. Please try to simplify it like below.
It looks better too.
my_dict = {'x':500, 'y':5874, 'z': 560}
key_max = max(my_dict, key = my_dict.get)
key_min = min(my_dict, key = my_dict.get)
print('Maximum Value: ',my_dict[key_max])
print('Minimum Value: ',my_dict[key_min])

Neuroimaging 'nipype ' plugin not working

I was working on something an I this is actually my first time so things are not that clear for me yet, I ran this code :
pip install nipype
from nipype import Node, Workflow
from nipype.interfaces.fsl import SliceTimer, MCFLIRT, Smooth
slicetimer = Node(SliceTimer(index_dir=False,
interleaved=True,
time_repetition=2.5),
name="slicetimer")
mcflirt = Node(MCFLIRT(mean_vol=True,
save_plots=True),
name="mcflirt")
smooth = Node(Smooth(fwhm=4), name="smooth")
preproc01 = Workflow(name='preproc01', base_dir="dir_path")
preproc01.connect([(slicetimer, mcflirt, [('slice_time_corrected_file', 'in_file')]),
(mcflirt, smooth, [('out_file', 'in_file')])])
slicetimer.inputs.in_file = "file_path"
preproc01.run('MultiProc')
This is the error shown when I run the last line of code :
"Could not import plugin module: nipype.pipeline.plugins"
There is one more problem :
When I try to run this code :
preproc01.write_graph(graph2use='orig')
This is the error message shown :
'No command "dot" found on host. Please check that the corresponding package is installed.'
please if anyone knows the solution help me out.
BTW I an doing this from a video series, here is the link :https://www.youtube.com/watch?v=4FVGn8vodkc&t=4414s
Nipype showcase section.

XLWings - app.display_alerts = False not suppressing bad formula error message

I am using Python 3.8.3 and XLWings 0.19.5. I am trying to write a try...catch while running excel equations directly in a workbook, but equations with certain errors are causing the application to hang. I think this is due to a message box popping up.
import xlwings as xw
appExcel = xw.apps.add()
appExcel.display_alerts = False
appExcel.screen_updating = False
wbEquation = xw.Book()
wbEquation.sheets.add(name='Calculate')
wsEquation = wbEquation.sheets['Calculate']
badFormula = "=A1+(A2+A3"
try:
wsEquation.range('B1').formula = badFormula
except Exception:
appExcel.quit()
raise Exception("There was an error when running the equation.")
With display_alerts=False I am not sure why it is getting hung on the wsEquation.range('B1').formula = badFormula line, I believe due to a There is a problem with a formula error. On the older version of XLWings 0.10.0 I was running it does not get hung up and moves past the error message when I try and execute this equation.
*Edit: So I tested to see which version exactly breaks it and I was able to keep it working through 0.11.5. Upgrading to 0.11.6 broke it. I do not see anything in the release notes between the two versions suggesting why that would be.
So for right now I am fixing by rolling back to 0.11.5:
pip install "XLWings==0.11.5"
I have put in a bug report: link and it was marked as a bug so I think they will be working on it.

IProgress Error while material query via MPRester

I am using python 3.8 in spyder3. I am getting an error while doing:
mp=MPRester('api key')
data = mp.query(criteria={}, properties=['task_id']) #this line raises error
The error is :
NameError: name '**IProgress**' is not defined.
During handling of the above exception, another exception occurred:
ImportError: **FloatProgress** not found. Please update jupyter and ipywidgets.
But I'm not working with Jupyter notebook and ipywidgets is updated. This problem doesn't happen while working in Google collab.
Installing these two worked for me:
pip install ipywidgets IProgress
I am not answering the error but showing a worked script for me. Using the following approach might help.
from pymatgen import MPRester
api = MPRester("your key")
# criteria you want
criteria={"elements":{"$all": ["O"]}, "nelements":{'$lt':4}}
# properties you want
properties = ["pretty_formula", "cif", "material_id"]
c = api.query(criteria=criteria,properties=properties)

Python: Name "extract_training_sample" is not defined error

I am a Python newbie currently looking into Crash Course Ai #5 How to Make an AI read your handwriting (LAB).
Running Step 1.2 gives me *NameError: name 'extract_training_samples' is not defined.
Tried so far: 1) updated pip version to 20.0.2 and installed emnist python package
2) tried an additional line of code: from emnist import extract_training_samples but got a ModuleNotFound error.
Feedback appreciated!
OK, very simple solution!
You just forgot the "s".
I find myself running into that problem all the time when coding. Whenever I run into a Name Error, the first thing I do is check my spelling!
your code:
x, y = extract_training_sample('letters')
the code on the website:
extract_training_samples('letters')
Cheers,

Categories

Resources