I have a python program that has been running well for several years on a laptop in my office. The laptop is a windows device and python was installed using a windows installer. I am using python 2.7.8 on my laptop. The program basically checks an email address for specific emails and if it finds them it processes the data in them, re-packages the data into png's and ftp's it to a specific folder on my Godaddy shared hosting account and my website will then display the images. Been working fine for years. However that laptop has now died and it's now time I put this python program in the cloud. While Godaddy does has python its default version is 2.6.6 but you can access their 2.7.2 version with #!/usr/local/bin/python2.7 but since it is only 2.7.2 I decided to install python 2.7.8 on my shared hosting account since that is the version I have been successful with. So now that I have manually installed python I am running my program via SSH to see where it chokes and add the necessary packages. I am at a point where I am a bit stumped. I am getting a connection refused error;
Traceback (most recent call last):
File "CTWRT.py", line 627, in <module>
myEmailConnection = poplib.POP3_SSL(mailServer)
File "/home/tcimaglia/python27/lib/python2.7/poplib.py", line 350, in __init__
raise socket.error, msg
error: [Errno 111] Connection refused
mailServer = "pop.secureserver.net"
Does this have anything to do with running this program on the Godaddy shared host and trying to access an email that is linked to this account, something#my-domain.com? This command works just fine when running on my laptop. Should mailServer be something else?
Related
ssh_client =paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.load_system_host_keys()
ssh_client.set_missing_host_key_policy(paramiko.WarningPolicy)
ssh_client.connect(hostname='abc',username='admin',password='admin')
with SCPClient(ssh_client.get_transport()) as scp:
scp.put(local_path='example.txt',remote_path='/abc')
I am trying to connect to a Windows system and send a file example.txt to it. But if I run the script, it gives the following error when sending a file to a windows system
paramiko.ssh_exception.NoValidConnectionsError: [Errno None] Unable to connect to port 22 on 'IP Address'
Help would be appreciated.
Edit: The Windows system that I am sending the file to runs a Windows 2008 server.
If you want to connect with Paramiko SSH/SFTP/SCP library to a machine, the machine must be running SSH/SFTP/SCP server.
Windows does not come with SSH/SFTP/SCP server running by default.
See Windows SSH Servers? question on Super User.
What are the different modules/ways to copy file from a windows computer to a linux server available in python
I tried using ftplib api to connect to the windows server but i m unable to do with the error - socket.error: [Errno 111] Connection refused
What are the other modules that i can connect to a windows computer to copy or list the files under a directory
If you have access to linux server, and the file generated on windows automatically, you can do the folowing:
Generate ssh-key on your windows maching
Add it to authorized_hosts of the linux machine
Install simple console scp tool on windows
Write simple cmd-script to copy file with help of scp, something like:
scp c:\path\to\file.txt user#linuxhost.local:/home/user/file.txt
Run this script automatically every time, then the file is generated on windows host.
I am trying to move a file from my local box to my VM using Python but I can't due to ssh error stating it can't connect. That makes sense as I don't have sshd installed on the VM yet.
It seems like my next step is to get ssh install onto my VM but I'm not sure how as I don't know how to move a file from the workstation to the VM. Any advice is appreciated.
import subprocess
subprocess.check_call(["scp","/desktop/test.txt","<user>#<PC-name>:\<PC-name>\C$\user\<user>\desktop\test.txt"])
I am using a windows XP machine that is using Microsoft SQl Server Enterprise Edition version 8.00.194, SQL-DMO version: 8.00.02 and ODBC version : 03.52.0000. I have another database of MySql on some other machine in the same network and I want to retrieve the data from that database to my XP machine's Sqlserver database. For this purpose I am trying to check whether I can connect to the local machine with my following python script (I use the pymssql library for this purpose):
import pymssql
con1=pymssql.connect(server="localhost:1433",user="XXXX",password="XXXX",database="XXXX")
print con1
con1.close()
I have purposefully removed the original username, password and db name. After running the above script I get the error:
Traceback (most recent call last):
File "D:\py_script_data_1st\1.py", line 9, in <module>
con1=pymssql.connect(server="localhost:1433",user="xxxx",password="xxxx",database="xxxx")
File "pymssql.pyx", line 636, in pymssql.connect (pymssql.c:10178)
OperationalError: (20009, 'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist\nNet-Lib error during Unknown error (10061)\n')
I have searched extensively but did not get any working solution for that error. What I got was to open the port 1433. I have opened the sqlserver.exe instance in my firewall by following the instructions given https://support.microsoft.com/en-us/kb/841251
When I do telnet on port 1433 by using:
telnet localhost 1433
I get error that says could not connect to port 1433.
I would also like to add that the database on which I am working is of a library system. There are two machines on which issues/returns trasactions of the book takes place. So the other machine (which is also a windows XP machine) connects to the server machine using a software that uses netbios-ssn for the communication. I found this fact by using netstat command. Here is the output of that command:
TCP issue:netbios-ssn 192.168.48.45:2211 ESTABLISHED
TCP issue:netbios-ssn 192.168.48.48:3456 ESTABLISHED
I am extremely confused about these facts. I don't understand how can other machine access server's database using netbios-ssn port?
So, I have effectively two questions and solution to any one of them can help me out.
What is the solution for the problem of the python script ?
If the first problem cannot be solved, how can I achieve the connection to the database using netbios-ssn port?
Please help and feel free to ask any further information if you want.
I'm trying to run RabbitMQ Python tutorial but with sender on virtualbox host machine and receiver and queue on virtualbox guest machine. So I modified mentioned send.py code by only replacing localhost with 192.168.1.5. When I run it, i receive following error:
...
File "/home/damian/.virtualenvs/kivy_1.9/local/lib/python2.7/site-packages/pika/adapters/base_connection.py", line 153, in _check_state_on_disconnect
raise exceptions.ProbableAuthenticationError
pika.exceptions.ProbableAuthenticationError
rabbitmq-server seems to be running, because when I stop it send.py gives me:
...
File "/home/damian/.virtualenvs/kivy_1.9/local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 301, in _adapter_connect
raise exceptions.AMQPConnectionError(error)
pika.exceptions.AMQPConnectionError: Connection to 192.168.1.5:5672 failed: [Errno 111] Connection refused
which makes perfect sense.
How to fix that ProbableAuthenticationError?
Host machine is Debian 7 with Python 2.7.3 and pika 0.9.14, guest is Ubuntu 15.04 with rabbitmq-server 3.4.3-2
This is because you are trying to authenticate using the username and password guest remotely. Starting with RabbitMQ 3.3 you need to create a new account to use remotely, and guest/guest can only be used locally.
This is taken from the change log here.
25603 prevent access using the default guest/guest credentials except via localhost since (1.0.0)
It's possible to modify the RabbitMQ configuration to allow remote access using the guest account, by removing guest from loopback_users, but it's recommended to create a new user to follow best practices.
[{rabbit, [{loopback_users, []}]}].