syntax-error

NodeJS script with async/await causing syntax error (v7.10.0)

♀尐吖头ヾ 提交于 2019-11-27 06:38:12
问题 I am trying to use async/await in NodeJS but my script is throwing a syntax error. I was under the impression that async/await is supported naively since Node 7.6. When I run node -v I get v7.10.0 . Here is the contents of index.js : async function getValueAsync() { return new Promise(function(resolve) { resolve('foo'); }); } let value = await getValueAsync(); console.log(value); But when I invoke this script with node index.js I get: let value = await getValueAsync(); ^^^^^^^^^^^^^

PHP anonymous function causes syntax error on some installations

做~自己de王妃 提交于 2019-11-27 06:32:44
问题 I have the following code: $file_check_method_func = function($n) { $n = absint($n); if(1 !== $n) { $n = 0; } return $n; }; $valid['file_check_method'] = array_map($file_check_method_func, $input['file_check_method']); This works on my PHP 5.3.5 installation but when I run this code on a PHP 5.2.15 installation I get: Parse error: syntax error, unexpected T_FUNCTION in /home/xxxx/public_html/xxxx/xxxxxxx/wp-content/plugins/wordpress-file-monitor-plus/classes/wpfmp.settings.class.php on line

Visual Studio displaying errors even if projects build

南笙酒味 提交于 2019-11-27 05:52:01
I have a problem with Visual Studio on a C# solution. It displays totally random errors, but the projects build. Right now, I have 33 files with errors, and I can see red squiggly lines in all of them. I tried cleaning / rebuilding the solution, closing Visual Studio and even restarting my computer. I also made sure to do the steps described in Debugging runs even with compiler's errors in Visual Studio. I can modify .cs files and I see the changes in the solution. Does anyone have an idea about why it does that? If you have ReSharper, try emptying the ReSharper cache: In menu, ReSharper >

Unexpected keyword_end error, yet syntax seems fine

好久不见. 提交于 2019-11-27 05:42:43
This function is supposed to pull names from a Comma Separated Values file, and place them into an array. def xprt_csv_to_ary(csv_file) namecatcher_regex = "/^[\.{1}]([A-Z]+)\.{3}/" # Matches up to char before next name current_word = 0 names_array = [] while current_word < 5000 if current_word == 0 name = csv_file.readline.match(namecatched_regex) else name = csv_file.past_match.match(namecatcher_regex) end names_array[current_word] = name current_word ++ end return names_array end I'm getting the following error: syntax error, unexpected keyword_end I would be as happy to be referred to an

SyntaxError: Generator expression must be parenthezised / python manage.py migrate

最后都变了- 提交于 2019-11-27 05:41:43
问题 I'm really new in programming and I wanted to follow the Djangogirls tutorial, but I'm stucked now. In the tutorial, I am here: To create a database for our blog, let's run the following in the console: python manage.py migrate (we need to be in the djangogirls directory that contains the manage.py file). If that goes well, you should see something like this: ... There is no option to fail in the tutorial but I have an error message: (myvenv) C:\Users\Julcsi\djangogirls> python manage.py

PHP 5.4 vs 5.3 app errors

天大地大妈咪最大 提交于 2019-11-27 05:40:09
I am building an web app with php and built it in php 5.4. However, I just realized my server run only 5.3 or 5.2. In my controller file I have this line of code $this->load->model('admin/upholstery_category_admin'); $this->load->helper('url'); if($method == 'add') { $categories = $this->db->get('category')->result(); line 158 here>> $data = []; $data['cats'] = $categories; $data['message'] = ''; which is causes this error Parse error: syntax error, unexpected '[' in /home/content/51/6663351/html/application/controllers/admin.php on line 158 How do i change the syntax to correct this? change:

Why can't attribute names be Python keywords?

本小妞迷上赌 提交于 2019-11-27 05:34:45
There is a restriction on the syntax of attribute access, in Python (at least in the CPython 2.7.2 implementation): >>> class C(object): pass >>> o = C() >>> o.x = 123 # Works >>> o.if = 123 o.if = 123 ^ SyntaxError: invalid syntax My question is twofold: Is there a fundamental reason why using Python keyword attribute names (as in o.if = 123 ) is forbidden? Is/where is the above restriction on attribute names documented? It would make sense to do o.class = … , in one of my programs, and I am a little disappointed to not be able to do it ( o.class_ would work, but it does not look as simple).

syntax error near unexpected token `$'in\r''

可紊 提交于 2019-11-27 05:21:39
问题 I'm trying to compile the NIST Biometric Image Software, and I have been having trouble all day. I finally got the source checked out right, and I installed cygwin with no problems (I have used it in the past), but when I went to compile, I get this error: $ sh setup.sh </cygdrive/c/NBIS> [--without-X11] setup.sh: line 94: syntax error near unexpected token `$'in\r'' 'etup.sh: line 94: ` case $1 in Now I'm sure any advanced coder would head to the setup.sh and look for problems, but I'm not

Why and I getting: “Invalid regular expression. Uncaught SyntaxError. Invalid escape.”?

♀尐吖头ヾ 提交于 2019-11-27 04:53:55
问题 Im trying to create an html input tag that accepts only numbers entered in 1 of 2 formats, and reject all other input. I want to accept numbers in these formats only, including requiring the dashes: 1234-12 and 1234-12-12 note: this is not for dates, but rather legal chapter numbers Everything I am reading about regex says that the following should work, but it isn't. <input class="form-control" type="text" pattern="^(\d{4}\-\d{2}\-\d{2})|(\d{4}\-\d{2})$" required /> Devtools Console Error in

How to solve SyntaxError on autogenerated manage.py?

拜拜、爱过 提交于 2019-11-27 04:27:26
I'm following the Django tutorial https://docs.djangoproject.com/es/1.10/intro/tutorial01/ I've created a "mysite" dummy project (my very first one) and try to test it without altering it. django-admin startproject mysite cd mysite python manage.py runserver File "manage.py", line 14 ) from exc ^ SyntaxError: invalid syntax I'm getting a SyntaxError on a file that was generated by the system itself. And I seem unable to find anyone else who has gone through the same issue. I'll add some data of my setup in case it may be of use $ vpython --version Python 2.7.12 $ pip --version pip 9.0.1 from