Questions tagged [positional-parameter]

104 questions
0
votes
0 answers

Problem with arguments in Bash in console

I have a Big problem and I don't know how can I solve this. #!/bin/bash function prueba(){ valor=$1 echo "Hola ${valor}" } prueba $valor so, when i write in the console: ./beta1.sh prueba 123 print: Hola I expected to see: Hola…
0
votes
0 answers

python argparse up to 3 positional arguments, optional flags for each

I want to create such a thing: program.py list contracts --minc MIN --maxc MAX in which --XXXc corresponds with contracts. The positional params (which actions to be performed) may be up to 3 (list, contracts, ticks - at least one, maximum of 3),…
0
votes
1 answer

Why is it not possible to combine `...` and named arguments in Ruby 3?

In Ruby 3, the new ... syntax was introduced, allowing constructs like these: def locked_run(...) lock run(...) unlock end This is documented here: https://rubyreferences.github.io/rubychanges/3.0.html After this discussion…
Kalsan
  • 822
  • 1
  • 8
  • 19
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
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
  • 497
  • 9
  • 17
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
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
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
  • 1,384
  • 2
  • 14
  • 29
0
votes
1 answer

Why do I get "SyntexError: non-keyword arg after keyworkd arg" when my function doesn't specify keyword arguments in Python?

I read about positional arguments and keyword arguments, but I still don't understand why I get SyntexError: non-keyword arg after keyworkd arg from running the following code. I didn't specify any keyword arguments in my objective function,…
0
votes
0 answers

python *args list of positional parameters

I have a function that takes as input *args: def foo(*args): for a in args: print(a) This works as intended > foo('a', 'b') > a > b I am faced with a situation where I don't know how many args are going to be passed (which is the…
gmarais
  • 1,801
  • 4
  • 16
  • 32
0
votes
1 answer

Run a bash script within Automator using positional parameters

This is my first time using Automator and it seems like a pretty nifty tool. I am running into an issue however at the very end of the automation. The goal of my automator workflow is to specify a path, then create a directory Highschool1, for…
LobsterBoy
  • 15
  • 3