Questions tagged [positional-parameter]

75 questions
1
vote
4 answers

setting a positional parameter in a function in bash

I'm making a function to easly convert my strings to arrays as I need to. I am somewhat running into a weird issue. I am still new to bash and this is really bugging me. Would anybody be able to shed some light onto…
IT kid
  • 43
  • 4
1
vote
1 answer

accessing a positional parameter through a variable

I'm trying to access a positional parameter using a variable. i.e. if I define a variable as 1, I want to access the 1st positional parameter, if I define it as 2 I want to access the 2nd positional parameter. example: bash script.bash arg1 arg2…
Maverick Meerkat
  • 3,847
  • 2
  • 31
  • 49
1
vote
2 answers

How do I print the help interface on argparse with 2 positional arguments?

I'm learning the basics of argparse, and I have made a program that prints information on the solar system in the command line, however, I have used 2 positional arguments which is causing some complications. My aim is to print the 'help' interface…
cact1
  • 11
  • 2
0
votes
0 answers

super().__init__(self,name,age,gender,address) TypeError: __init__() takes 5 positional arguments but 6 were given

when creating Student() instance, it shows type error, super().init(self,name,age,gender,address) TypeError: init() takes 5 positional arguments but 6 were given I tried many way but i did not succeed. please help me to solve this!!! def…
0
votes
0 answers

TypeError: vertices() takes 1 positional argument but 2 were given

Guys Kindly help me wrt main class where whenever i execute it throws an error i dnt think anything is wrong..In this program i used DFS and BFS to print shortest paths from the graph but class Graph(object):kindly review main class for errors.. def…
0
votes
3 answers

TypeError: get() missing 1 required positional argument: 'url' using ChromeDriver and Chrome through Selenium and Python

Following code is supposed to open Google chrome and Walmart page, but I came across the error below. Code: from selenium import webdriver driver = webdriver.Chrome driver.get('https://www.walmart.com/') Error: Traceback (most recent call…
0
votes
1 answer

Order of using positional and keyword arguments

Apparently, if you need to use both keyword and positional arguments while calling your function, you have to use the positional argument first. But the following code results in an error; def greet(first_name, l_name): print(f'Hi, {first_name}…
0
votes
1 answer

Powershell: how to properly use ValueFromRemainingArguments?

I'm following along the official Microsoft tutorial in order to define one mandatory positional argument and any amount of remaining positional arguments that may follow by using ValueFromRemainingArguments. My attempt: function main { Param( …
kamokoba
  • 413
  • 6
  • 14
0
votes
2 answers

Python Interpreter Says that I am missing a positional argument. I am a little new to passing arguments and confused

I am doing a project on passing arguments through functions. My problem is that I am writing a program that gives the charged amount based on age and traffic violations. Here is my current code: print("Use this program to estimate your…
0
votes
2 answers

How do I pass multiple arguments to a shell script into `kubectl exec`?

Consider the following shell script, where POD is set to the name of a K8 pod. kubectl exec -it $POD -c messenger -- bash -c "echo '$@'" When I run this script with one argument, it works fine. hq6:bot hqin$ ./Test.sh x x When I run it with two…
merlin2011
  • 63,368
  • 37
  • 161
  • 279
0
votes
1 answer

Got multiple Arguements in one function call but not in another function call

I am working on Robot Framework, one of my base method is written in python for building a SQL query with n columns and multiple where conditions. The function looks like, from pypika import Query, Table, Field def…
0
votes
0 answers

django - edit_entry() missing 1 required positional argument: 'entry'

Helllo, I am getting this error when trying to retrieve the content of util.get_entry(entry). Where shoud I correct this " missing positional argument? Is possible I am getting this error because of my django version? Because it seems to work to a…
S Paiva
  • 1
  • 2
0
votes
1 answer

missing 1 required positional argument - Finance

I tried to do Portfolio optimization, but then the TypeError: minimize_sharpe() missing 1 required positional argument: 'log_returns' appeared: Please find the extract below. import scipy.optimize as optimize…
0
votes
1 answer

Using Map function with Lambda in Python: TypeError: () takes 0 positional arguments but 1 was given

System: WIN10 IDE: MS VSCode Language: Python version 3.7.3 Library: pandas version 1.0.1 Data source: base data supplied below Dataset: base data supplied below I am having an issue for some reason when trying to use the "map" function to map A…
0
votes
1 answer

Python: Nameless keyword argument list

What is the meaning of a lone star '*' in the parameter list of a Python function? I found it in the source of scikit-learn and haven't seen it before. I'm familiar with the concepts of positional and keyword arguments (*args, **vargs). I'm…
Adomas Baliuka
  • 673
  • 1
  • 7
  • 25