I'm starting out learning Python 3 on Linux and am attempting to write a script to notify me when I receive emails from certain people. The following code works fine in IDLE3 but I am encountering an invalid syntax error when I try to run it from Terminal:
tcd = imaplib.IMAP4_SSL('outlook.office365.com')
tcd.login(addr, password)
tcd.select('INBOX', readonly=False)
The Terminal error is as follows:
File "mailcheck.py", line 22
tcd = imaplib.IMAP4_SSL('outlook.office365.com')
^
SyntaxError: invalid syntax
Any advice would be greatly appreciated!
Turns out I was missing a closing parenthesis at the end of the line before this. Rookie mistakes >:-/
Related
I'm using the fact-extractor (link) to run their example of extracting info from the football wiki pages. I've installed and tested all dependencies on windows and when I execute "make extract-pages", i get the following error:
(dbpenv) C:\dbpedia\fact-extractor-master>make extract-pages
mkdir workspace-en
bzcat enwiki-latest-pages-articles.xml.bz2 | python lib/WikiExtractor.py -o workspace-en/pages
File "lib/WikiExtractor.py", line 598
print id, title.encode('utf-8')
^
SyntaxError: invalid syntax
bzcat: I/O or other error, bailing out. Possible reason follows.
bzcat: Invalid argument
Input file = enwiki-latest-pages-articles.xml.bz2, output file = (stdout)
make: *** [Makefile:39: extract-pages] Error 1
I can't make sense of the error. This is an as-is codebase from their repo so I'm not really sure how to fix this.
I am deploying a web server, and after I finish compiling.There are the executing documents;
01client.c client epoll_server.c server
Then I try to run server
./server
There is an error which I cant fix it. I have search ways for solving but still can't fix it.
load error: No such file or directory
Maybe some one can help me,please!
Thanks a lot!!!!
System utilities print the program generating the error at the beginning of the line followed by other useful information such as the name of the missing file, so this is probably an error from a user program. I can duplicate the error as follows:
errno = 2;
perror("load error");
which prints:
load error: No such file or directory
Look for the perror line in the server code. If it isn't clear what file it can't find, print the string from the failed command it is reporting.
I followed the usage steps as per the example, after the second step of defining "conn" the script terminates and comes back to the command line without raising any errors o warnings or exception.
I am not able to identify what went wrong, has anyone faced this issue with jaydebeapi?
Sharing the libraries/environment details I am using and screenshot.
Example:
import jaydebeapi
conn = jaydebeapi.connect("org.hsqldb.jdbcDriver",
... "jdbc:hsqldb:mem:.",
... ["SA", ""],
... "/path/to/hsqldb.jar",) --------my script terminates at this step
curs = conn.cursor()
Environment:
Windows 10 64bit
Python 3.7.4
JayDeBeApi==1.1.1
JPype1==0.6.3
sasl==0.2.1
thrift==0.10.0
thrift-sasl==0.3.0
Jar = hive-jdbc-1.2.1-standalone.jar
Resolution is appreciated.
Are you using same (i.e. 64 bit) versions of programms? Reinstallation from python 32 to python 64 helped me with the same problem.
I recently had a need for a Drupal fingerprint NSE script for an engagement. Through some research I stumbled upon a promising NSE Lua script to get the job done. Unfortunately, it seems like the author ceased the support for this script and the script was never officially incorporated into the Nmap NSE library. I decided to try and use the script anyways.
Upon attempting to run the script via the Nmap engine, I encountered an "invalid escape sequence" error. Not possessing any Lua programming experience, this error stopped me dead in my tracks. I am hoping someone with Lua experience would be able to help troubleshoot what looks like may be a pretty simple fix to the problem.
The error code is as follows:
root#kali:~# nmap --script=http-drupal-fingerprint.nse --script-args http-drupal-fingerprint.base-url=/ www.placeholder.com
Starting Nmap 7.70 ( https://nmap.org ) at 2018-09-26 12:33 EDT
NSE: failed to initialize the script engine:
/usr/bin/../share/nmap/nse_main.lua:259: /usr/bin/../share/nmap/scripts/http-drupal-fingerprint.nse:47: invalid escape sequence near '"Drupal [4-7].'
stack traceback:
[C]: in function 'assert'
/usr/bin/../share/nmap/nse_main.lua:259: in upvalue 'loadscript'
/usr/bin/../share/nmap/nse_main.lua:601: in field 'new'
/usr/bin/../share/nmap/nse_main.lua:828: in local 'get_chosen_scripts'
/usr/bin/../share/nmap/nse_main.lua:1315: in main chunk
[C]: in ?
QUITTING!
The script was imported into the NSE library as so:
curl -ksL https://raw.githubusercontent.com/r3dh4nds/NSE-Drupal-Fingerprint/master/http-drupal-fingerprint.nse >> /usr/share/nmap/scripts/http-drupal-fingerprint.nse && chmod 0644 /usr/share/nmap/scripts/http-drupal-fingerprint.nse
I am including the original source of the script from SecLists:
https://seclists.org/nmap-dev/2011/q2/490
Any help much appreciated! (Sorry if this question is somehow not formatted correctly, first post)
Drupal detection in Nmap is now done with the http-enum script. You can add --script-args http-enum.category=cms to limit the number of enumeration probes sent to only those which would detect Drupal. You may also be interested in the http-drupal-enum and http-drupal-enum-users scripts, as well as http-form-brute which can brute-force Drupal authentication.
As I suspected it was a simple fix. Removed the invalid escape sequences at:
local expression = "Drupal [4-7]\.[0-9][0-9]?\.?[0-9], "
to
local expression = "Drupal [4-7].[0-9][0-9]?.?[0-9], "
and got rid of that error.
I followed the steps in a respose to how to Set up Python for IIS :
Python on IIS: how?
But when I write my script and try running it it fails on the first line. I get this error message:
HTTP Error 502.2 - Bad Gateway The specified CGI application
misbehaved by not returning a complete set of HTTP headers. The
headers it did return are " File
"C:\Development\Python\helloworld.py", line 1 print 'Content-Type:
text/plain' ^ SyntaxError: invalid syntax ".
This is my frist attempt at python. What is going wrong?
So your example helloworld.py needs to be changed to:
print('Content-Type: text/plain')
print('')
print('Hello, world!')
Python 3 changed print to use function call syntax (which can be used in python 2).