Python27-try/except issue - gae-python27

Why the else function not running after below, it can be saved:
def OnButtonSavedata(default):
Number=numberctrl.GetValue()
if len(Number)==9:
try:
float(Number)
except ValueError:
wx.MessageBox('Just number please','Info',wx.OK|wx.ICON_INFORMATION)
else:..
Please help me what I left off.
Thanks

Related

How do I turn a list into a vector?

I found this code on GitHub for simulating covid data in Rstudio but I am unable to get it to run. The following lines
# calculate how much infectiousness arises from all teachers (t_bI) and all pupils (p_bI)
sim$t_bI[d_iter] = sum(as.vector(sim[d_iter,paste0("t_I_",seq(1,15,1))]*infectiousness_over_time))
sim$p_bI[d_iter] = sum(as.vector(sim[d_iter,paste0("p_I_",seq(1,15,1))]*infectiousness_over_time_child))
return this error
Error in sum(as.vector(sim[d_iter, paste0("t_I_", seq(1, 15, 1))] * infectiousness_over_time)) :
invalid 'type' (list) of argument
I won't paste the entire code here but it is available at
https://github.com/annabershteyn/ACTA_Dx/blob/main/school_sim_R/simulate_school_transm.R
Thanks so much for any help!

show all unique value from column

I try to show all value from a dataframe column with this code combinaison_df['coalesce'].unique()
but I got this result :
array([1.12440191, 0.54054054, 0.67510549, ..., 1.011378 , 1.39026812,
1.99637024])
I need to see all the values. Do you have an idea to do?
Thanks
If I have this situation but don't want to change it for every print() statement I found this solution with a context manager quite handy:
with pd.option_context('display.max_rows', None):
print(combinaison_df['coalesce'].unique())

How to declare a datetime type of variable in ssms

this is the code i tried and i got some errors in it I need to create a variable named createddate and use it in the another table.
along with that if user enters only 4 inputs where 5 inputs are required then also it should give invalid input and exit the program.
Please provide a working example in which you can only enter 4 inputs to your program after defining the amount as 5. Do so without changing the way the inputs are aquired, and please also provide a step by step explantion how you are able to do that.
Your while n1 !=n2: loop ensures, that user will have to enter the correct number of inputs. Otherwise he will not come out of loop. Is that not what you require?
I have written a code for you, please let me know is this u wanted ??
MIN_LENGTH = 0
MAX_LENGTH = 21
a = int(input('Total number of plots: '))
if a<MIN_LENGTH or a>MAX_LENGTH:
print('Invalid Input')
exit()
lst=[]
for i in range(a):
ch = input(f'do you want to enter value for plot {i+1} (y/n)')
if ch=='y':
value = int(input(f'Enter value for plot {i+1}: '))
if value<0:
print('Invalid Input')
exit()
lst.append(value)
else:
print('Invalid Input')
exit()
n =1
for i in lst:
print(f'plot:{n}= {i}')
n+=1
add below code after n2+=1
if n2>4:
break

R - Error in rsqlite_bind_rows(rs#ptr, value) :

I hope you can help me with this.
I've imported 3 json files in R and used streamed in to get 3 df's on which I can do queries with sqldf. On 2 of them it works fine, but on the third one I get this error when using:
sqldf('select * from fixfull where checksum is "121"')
Error in rsqlite_bind_rows(rs#ptr, value) :
Can only bind lists of raw vectors (or NULL)
I get the same error message for all other queries on this df. Don't know what is wrong specifically, and can't find other related errors on stackoverflow.
Could someone help?
Thanks a lot!!
Vmontreal

Filter records based on groups [Odoo]

I am trying to filter the records based on their group id. I have written a domain filter in menu action like this
[('pending_approver','in',[g.id for g in user.groups_id])]
pending_approver is a Many2one field with res.groups
Have a look on this for more clarification.
def _default_approver(self):
obj = self.env['approval_heirarchy.approval_rules'].search([('id', '=', 1)], limit=1)
if obj.x_approver_ids:
val = obj.x_approver_ids[0].x_user_ids
return obj.x_approver_ids[0].x_user_ids.id
pending_approver = fields.Many2one('res.groups', string="Pending Approver", readonly=True,default=_default_approver)
Whenever run the application prompt an Odoo Client Error:
Uncaught Error: Expected "]", got "(name)"
I've searched a lot but didn't find any solution.
Any help will be a great regard for me. Thanks in Advance!
if self.user_has_groups('sales_team.group_sale_manager') is True:
code part...
this code may help you.....any queries please free to ask