Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Variable scope - "global x" didn't work...
Post: RE: Variable scope - "global x" didn't work...

(Dec-25-2020, 12:44 AM)bowlofred Wrote: (Dec-25-2020, 12:00 AM)ptrivino Wrote: Thank you. The thing I am trying to fix is that when I do this in a third-level function: for curr_id in dict_1: # l...
ptrivino General Coding Help 5 3,034 Dec-28-2020, 04:52 PM
    Thread: Variable scope - "global x" didn't work...
Post: RE: Variable scope - "global x" didn't work...

(Dec-24-2020, 08:13 PM)bowlofred Wrote: You call it a copy, but there are no copies made anywhere. When you pass an object to a function, if that object is mutable the function can modify it. Her...
ptrivino General Coding Help 5 3,034 Dec-25-2020, 12:00 AM
    Thread: Variable scope - "global x" didn't work...
Post: Variable scope - "global x" didn't work...

I am struggling to understand updating a 'global' dictionary (i.e., it's defined in the main module and I want to update it in a subroutine). I understand that I need to do something since dict_1 in t...
ptrivino General Coding Help 5 3,034 Dec-24-2020, 07:17 PM
    Thread: [python=name.py] Issue
Post: [python=name.py] Issue

I made a post earlier, and I found that when I click the Python (to insert code in the post) it asks for a name/label. But when I supply one, the [python=name.py] shows up in the post but the code isn...
ptrivino Board 1 1,962 Oct-24-2020, 10:42 PM
    Thread: Modules and namespaces (again?)
Post: Modules and namespaces (again?)

Perhaps all I need is someone who can describe how to do this. I am writing a program which is getting lengthy, and wanted to move some subroutines to a separate 'module.' I realize Python modules are...
ptrivino General Coding Help 1 1,855 Oct-24-2020, 10:25 PM
    Thread: Cant start module
Post: RE: Cant start module

(Nov-01-2019, 01:24 PM)bejag Wrote: Hi all, I cant start server under windows anymore. [Image: https://image.prntscr.com/image/54AZse3T...JirLNQ.png] then windows firewall prompted for access I ch...
ptrivino Networking 4 2,452 Nov-02-2019, 12:32 AM
    Thread: Working socket() program...isn't
Post: RE: Working socket() program...isn't

OK, this may well have been going on for some time. But here's what I've found: When logged in as myself, in a virtual environment, 'python' runs 3.6.x: Output:(pagesniff) [a-ptrivino@insecpydev pag...
ptrivino Networking 10 6,441 Nov-02-2019, 12:25 AM
    Thread: Working socket() program...isn't
Post: RE: Working socket() program...isn't

(Nov-01-2019, 08:58 PM)nilamo Wrote: Quote:(pagesniff) [a-ptrivino@insecpydev pagesniff]$ sudo python sniffsms.py server sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0) /...
ptrivino Networking 10 6,441 Nov-01-2019, 10:35 PM
    Thread: Working socket() program...isn't
Post: RE: Working socket() program...isn't

(Nov-01-2019, 07:14 PM)nilamo Wrote: Support for using sockets with the context manager (with-block) was added in 3.2. You said you've checked that they're both at least 3.6, but could you double c...
ptrivino Networking 10 6,441 Nov-01-2019, 07:51 PM
    Thread: Working socket() program...isn't
Post: RE: Working socket() program...isn't

(Nov-01-2019, 05:45 PM)Gribouillis Wrote: Try to output the same thing from within your program, just before the with statement because obviously a strange object is created by your call to socket.s...
ptrivino Networking 10 6,441 Nov-01-2019, 06:54 PM
    Thread: Working socket() program...isn't
Post: RE: Working socket() program...isn't

(Nov-01-2019, 06:32 AM)Gribouillis Wrote: Can you log the output of dir(socket.socket()) ? Quote:Python 3.6.6 (default, Aug 13 2018, 18:24:23) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux Type ...
ptrivino Networking 10 6,441 Nov-01-2019, 05:07 PM
    Thread: Working socket() program...isn't
Post: Working socket() program...isn't

I'm pretty new to Python, and newer still to socket() but I've been working on learning it. I implemented the "Echo Client and Server" from https://realpython.com/python-sockets/#tcp-sockets and it w...
ptrivino Networking 10 6,441 Nov-01-2019, 01:50 AM
    Thread: Quick sockets question...
Post: RE: Quick sockets question...

(Sep-26-2019, 05:11 AM)Gribouillis Wrote: AF_PACKET is already in the 3.6 documentation. So it is, odd they would kinda mark it as 'new' like that. Thanks.
ptrivino Networking 2 2,224 Sep-26-2019, 08:51 PM
    Thread: Quick sockets question...
Post: Quick sockets question...

Before I post a code question, let me ask this first: I am trying to use an AF_PACKET socket. The Python docs at https://docs.python.org/3/library/socket.html say that AF_PACKET is "New in version 3.7...
ptrivino Networking 2 2,224 Sep-25-2019, 08:39 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020