By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,887 Members | 1,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,887 IT Pros & Developers. It's quick & easy.

py2exe distribution wants internet access (DNS)

P: n/a
Hello,

I've made a small GUI program that connects with a MySQL database to
collect information which is put on the screen. The database and the
program are used for testing purposes so I installed them locally and
only use them locally (so on my own computer).

When I run the script from a system (WinXP) shell through the python
interpreter all goes well. However when I make an executable program of
it through py2exe there's a problem. When I start the .exe file the
program wants to 'talk' to my DNS on the internet. My firewall sees this
and asks me if this all right.

Now if say 'yes' to the firewall the program runs as expected. But if I
say 'no' my program won't connect to the MySQL server. Now this isn't
quite right, I run MySQL locally so DNS access should not be necessary.
This firewall stuff also makes distributing the program harder: not all
users have access to firewall choices, on some machines programs are
blocked by default.

Why does the original python script run normally but does the py2exe
'conversion' of it want DNS access? How can I change this?

Thanks in advance,
Otto Krüse
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Thu, 11 Mar 2004 11:26:12 +0100, Otto Krüse <ot********@hotmail.com>
declaimed the following in comp.lang.python:

Why does the original python script run normally but does the py2exe
'conversion' of it want DNS access? How can I change this?
Hypothesis: At some point in time you granted the Python
interpreter ITSELF access through the firewall. The file created by
py2exe may contain the interpreter, but it is NOT the same interpreter
to the firewall.

As a test, check your firewall configuration and remove all
Python related entries. Then see what happens. I suspect you'll find it
asks for access when run via "python xxx"
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #2

P: n/a
I don't think this is the answer because the python interpreter only
wants to access IP adress 0.0.0.0 for accessing it's subroutines. That's
something different than DNS access.

I think it has something to do with the MySQLdb module not being
'converted' as it should by py2exe.

My hypothesis:
When my program wants to connect with the MySQL dBase it sends a message
to the DNS to ask where it can find the MySQL server. DNS doesn't know
it so the program then checks locally and finds the MySQL server and
connects with it. However, if I block access to the DNS it will not find
the local server any more, this is strange I think.... In fact I don't
want my prgram to talk with a DNS, I want it to check for local servers
only.

Anyone know something about this?

Many thanks
Otto
Dennis Lee Bieber wrote:
On Thu, 11 Mar 2004 11:26:12 +0100, Otto Krüse <ot********@hotmail.com>
declaimed the following in comp.lang.python:

Why does the original python script run normally but does the py2exe
'conversion' of it want DNS access? How can I change this?


Hypothesis: At some point in time you granted the Python
interpreter ITSELF access through the firewall. The file created by
py2exe may contain the interpreter, but it is NOT the same interpreter
to the firewall.

As a test, check your firewall configuration and remove all
Python related entries. Then see what happens. I suspect you'll find it
asks for access when run via "python xxx"
--
> ================================================== ============ <
> wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wu******@dm.net | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #3

P: n/a
On Fri, 12 Mar 2004 13:17:08 +0100, Otto Krüse wrote:
My hypothesis:
When my program wants to connect with the MySQL dBase it sends a message
to the DNS to ask where it can find the MySQL server. DNS doesn't know it
so the program then checks locally and finds the MySQL server and connects
with it. However, if I block access to the DNS it will not find the local
server any more, this is strange I think.... In fact I don't want my
prgram to talk with a DNS, I want it to check for local servers only.


How about the line of code where you connect to the mysql server (i.e.
what IP are you using).

Regards,
Adam
Jul 18 '05 #4

P: n/a
On Fri, 12 Mar 2004 13:17:08 +0100, Otto Krüse <ot********@hotmail.com>
declaimed the following in comp.lang.python:
I don't think this is the answer because the python interpreter only
wants to access IP adress 0.0.0.0 for accessing it's subroutines. That's
something different than DNS access.
Huh... For local server it should be asking for
localhost/loopback - 127.0.0.1 if I recall. I've not tried anything that
needed a distributable installation, but my connect looks like:

myDB = MySQLdb.connect(host='localhost', user='bestiaria',
passwd='web-asst', db='bestiaria')

(It's a pain when one maintains web pages using MySQL database tables,
but do NOT have access to a server that permits CGI scripts -- meaning
one has to run a batch script every so often to update a template page
for upload to the web server)

I think it has something to do with the MySQLdb module not being
'converted' as it should by py2exe.
What's to convert? It just passes your connection string out.

Now, if your server is on a named host, you'll either have to
have that host listed in the hosts file (and the search order defined to
be hosts file followed by lookup), or you'll have to use DNS to
translate. If you physically list an IP number, it may be that MySQLdb
tries a reverse name lookup and, again, is not finding the host in a
hosts file so goes to DNS.
My hypothesis:
When my program wants to connect with the MySQL dBase it sends a message
to the DNS to ask where it can find the MySQL server. DNS doesn't know
it so the program then checks locally and finds the MySQL server and
connects with it. However, if I block access to the DNS it will not find
This implies that your system resolver sequence is DNS followed
by hosts -- though I'm not sure how the order is specified in Windows...

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.